Friday night’s Class 5A quarterfinal football matchup between the No. 1-seeded Cienega Bobcats and No. 9 Marana Tigers didn’t open exactly as the Bobcats would’ve liked, but it finished exactly how they wanted.

Thanks to a momentum-changing Hail Mary that ended the first half, Cienega (12-0) came back from an 11-point, first-half deficit to secure a 38-35 victory over Marana to advance to the state semifinals.

“We knew they were a great team and they scored 49 points a game for a reason … and our kids did just enough to win the game.” Cienega head coach Patrick Nugent said.

The Bobcats will play No. 5 Scottsdale Notre Dame Prep next Friday at a location to be determined.

Playing in front of a raucous group of Cienega supporters against an undefeated Bobcats team, Marana won the coin toss and elected to receive.

Within two plays, Marana had entered Cienega territory. A few plays later, the Tigers were within the red zone. And just three minutes into play, Marana junior dual-threat quarterback Trenton Bourguet ran in an 11-yard touchdown to put the Tigers up 7-0.

Cienega would come back. Led by the duo of senior quarterback Jamarye Joiner and junior wide receiver Terrell Hayward, the Bobcats scored 28 unanswered points — including 21 straight in the decisive third quarter — to go up 38-21.

Joiner kickstarted that run by twisting and turning his way through the middle of the Marana defense for an 80-yard rushing touchdown on the first play from scrimmage in the third quarter to give Cienega a 24-21 lead, just nine seconds into the half.

“We just came out in the second half knowing what we had to do and doing what we had to do,” Joiner said.

Joiner finished with three total touchdowns (two passing, one rushing), 322 passing yards and 245 rushing yards.

Hayward added his second, and final, touchdown of the game just two minutes later on a 2-yard rush to increase the lead to 31-21.

Capping off the scoring was senior wide receiver Terrell Huggins, who caught a 26-yard touchdown reception from Joiner with 1:22 left in the third quarter to make it 38-21 Bobcats.

However, Marana (9-3), which lost a 57-50 thriller to Cienega early in the season, wasn’t done yet.

Led by Bourguet, the Tigers fought to stay in the game with two fourth-quarter touchdowns.

The first came just nine seconds into the final quarter on a 30-yard throw and catch from Bourguet to senior wide receiver Teon Simmons to cut the lead to 38-28.

Both teams went back- and-forth from that point until Marana scored on a broken play on a passing touchdown from Bourguet to get within 38-35 with 1:28 left.

After Cienega recovered the onside kick, Marana attempted to use its three timeouts to stay in the game on the final possession, but Joiner iced the victory on a first-down run with 42 seconds left.

After falling behind 7-0 early, it didn’t take long for Cienega to respond, as junior running back Thomas Webb Jr. ran in a bruising 2-yard touchdown with 6:05 left in the first quarter to even up the score at 7.

The two teams went back and forth over the next 9:43 of game time before Marana added its second score of the game on a 2-yard touchdown from junior running back Rene Valenzuela.

Valenzuela’s touchdown put Marana up 14-7 with 8:12 left in the second quarter and put the momentum squarely back on the Tigers’ sideline.

Cienega entered the red zone and had a chance to even up Friday’s game around the four-minute mark of the second quarter, but the Marana defense came up huge and held the Bobcats to a 42-yard field goal with 3:42 left in the half.

The Tigers marched down the field and Bourguet added his second rushing touchdown of the game with 57 seconds left to increase their lead to 21-10.

However, just when it looked like Cienega would enter the halftime break down double digits, Cienega senior quarterback Jamarye Joiner evaded several Tiger defenders before tossing a 44-yard Hail Mary to junior wide receiver Terrell Hayward as the first half expired.

Hayward’s catch cut the Marana lead to 21-17 and gave Cienega all the momentum heading into halftime.

Cienega used that momentum to open the second half with a flurry and live to play another day.

“Right now we’re going to enjoy this because that’s a great team we beat and it’s always tough going to the semifinals,” Nugent said.

“We reached a goal and who knew we’d be 12-0 going to the state semifinals but we’re excited and we’re going to enjoy it, but coaches are back to work Monday morning.”