GLENDALE, Ariz. — Deebo Samuel was stunned to be so wide open for San Francisco’s first touchdown of the game. A few quarters later, Christian McCaffrey had enough time to catch a deep pass, fall to the turf, then scramble to his feet and run for a 41-yard touchdown.

Brock Purdy’s return to the desert as the 49ers quarterback was everything he ever dreamed — especially because Arizona’s defense was in a helpful mood.

McCaffrey scored three touchdowns, Samuel added two, and the 49ers clinched the NFC West title by pushing their winning streak to six games with a 45-29 win over the Cardinals on Sunday.

“In high school, I’d come watch the Cardinals, and now I’m playing on the field,” Purdy said. “It’s so cool. Definitely something I’ll look back on in life and be thankful.”

The Baltimore Banner thanks its sponsors. Become one.

The victory sets up a meeting of teams in position to win their conference’s No. 1 playoff seed. The Ravens (10-3) visit San Francisco (11-3) on Christmas night.

Purdy — making his first NFL start at State Farm Stadium, which is about 45 miles from where he grew up — completed 16 of 25 passes for 242 yards and tied a career high with four touchdowns. He also shook off a hard hit in the second quarter that caused him to miss a few plays.

Charvarius Ward had two interceptions, including a pick six in the first quarter.

During their winning streak, the 49ers have won all of their games by at least 12 points. They’ve also won 12 straight against divisional opponents in the NFC West.

San Francisco has won back-to-back division titles for the first time since the 2011-12 seasons. The 2012 season ended with a 34-31 loss to the Ravens in the Super Bowl, the “Harbaugh Bowl” matchup of coaching brothers John (Ravens) and Jim (then with the Niners).

The Baltimore Banner thanks its sponsors. Become one.

“Winning the division is very important — it’s a big step for us,” McCaffrey said. “But everyone knows where we want to be. We know that, each week, we have to play our best ball. We’re going to get everybody’s best shot, so the standard has to continue to rise.”

McCaffrey scored his second touchdown early in the third quarter, sneaking out of the backfield for a 41-yard score and a 28-13 lead. The running back was so wide open that he leaped for the catch, fell down, got to his feet and sprinted to the end zone.

“He does everything for us,” Purdy said. “Runs the ball well, catches the ball, everything. In my eyes, that’s an MVP.”

He made it there a third time later in the third quarter after plowing ahead 1 yard for the touchdown and a 35-16 advantage. Samuel followed with his second touchdown catch in the fourth, a 19-yard reception that made it 42-22.

The 27-year-old McCaffrey finished with five catches for 72 yards and two touchdowns while also running for 115 yards and a score.

More From The Banner