GLENDALE, Ariz. -- Phil Dawson's franchise-record string of 27 consecutive field goals ended with a missed 24-yard chip shot. The San Francisco kicker made up for it, to say the least, at the end of a wild 23-20 victory over the Arizona Cardinals on Sunday that clinched the NFC's No. 5 playoff seed.
Now the 49ers take a six-game winning streak into their first-round game at Green Bay.
"We would like to carry that momentum," said Anquan Boldin, who had a big game against his former team. "It felt like a playoff game. We came in here and won a tough game, so hopefully that will continue."
The 49ers (12-4) led 17-0 after one quarter, but needed two field goals from Dawson in the final 1:45. The first one matched his career long of 56 yards, the second was a 40-yarder to win the game as time expired.
"You live and learn on every kick, try to figure what I did wrong and apply that to future kicks," Dawson said. "I am glad it came down to the end to help our team win."
The teams combined for 16 points in the final 3:20.
After Dawson's 56-yarder put San Francisco up 20-17 with 1:45 to go, Jay Feely -- who had missed two earlier -- made a 43-yard field goal to tie it at 20 with 34 seconds left.
That turned out to be plenty of time for the 49ers.
"It doesn't matter how (we won)," San Francisco coach Jim Harbaugh said, "by any means necessary."
The crucial completion to set up the winning field goal, a 29-yard sidelines throw, went to rookie Quinton Patton, who in a season slowed by injury had just one catch before Sunday.
Boldin caught nine passes for 149 yards and a TD in his first game back since Arizona traded him to Baltimore after the 2009 season.
To make the playoffs, the Cardinals needed to beat San Francisco and have New Orleans lose to Tampa Bay. Neither occurred, leaving Arizona, in its first year under coach Bruce Arians, to settle for just its third 10-win season since the franchise moved to the desert in 1988.
"That comeback was as good as I've been around against a very good football team," Arians said. "It just shows what they've been through, they're persevering and fighting for 60 minutes. The thing that's really bad about the NFL is how abruptly it ends. We were really hoping to be playing next weekend and obviously we're not."
Palmer, after a slow start, was 28 for 49 for 407 yards and two touchdowns with one interception. In the process, he became the first player in NFL history to throw for more than 4,000 yards in a season for three different teams. Larry Fitzgerald had six catches for 113 yards.
San Francisco's NaVorro Bowman had an interception, a forced fumble, a fumble recovery and a sack in the 49ers' ninth victory in the last 10 meetings with Arizona.
Boldin did most of his damage in the first quarter, with six catches for 106 yards, including a 4-yarder for a touchdown and a 63-yard play to set up another TD.
But that was it for the San Francisco offense until Dawson's late two kicks.
Bowman's sack had put Arizona in third and 13 when Palmer lofted one to the end zone, where Roberts gathered it in just as he was sliding out of bounds on a slippery turf recently re-sodded for Wednesday's Fiesta Bowl.
Kaepernick's 18-yard pass to Boldin helped set up Dawson's 56-yarder, matching his longest, set in 2008.
Palmer, though, connected on passes of 24 yards to Rob Housler and 23 yards to Fitzgerald to give Feely a chance for redemption, and the kick that tied it at 20.
With the game seemingly headed for overtime, James raced from 5 yards deep in the end zone to the 49ers 40, then Kaepernick, in a play that started with just 18 seconds to play, completed a perfect pass to the untested Patton.
"I liked the matchup and there was no safety on that side of the field," Kaepernick said. "I thought I would give him a chance. He has shown that he can go up and make those plays in practice. He came up with it and it was huge for us."
Then, Dawson's final field goal ended it.
The 49ers beat Green Bay 34-28 in San Francisco in the season opener ... Arizona NT Alameda Ta'amu left in the second quarter with a right knee injury. ... Arizona WR Michael Floyd's string of 25 straight catches that went for first downs ended in the first quarter when he caught a 6-yarder. ... The 49ers finished 5-1 against the NFC West; Arizona was 2-4.