GLENDALE, Ariz. - Phil Dawson's franchise-record string of 27 consecutive field goals ended with a missed 24-yard chip shot, but 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 (10-6) on Sunday that clinched the NFC's No. 5 playoff seed for the 49ers.

Now the 49ers take a six-game winning streak into their first-round game at Green Bay.

San Francisco (12-4) led, 17-0, after one quarter but needed two field goals from Dawson in the final 1 minute and 45 seconds. The first one matched his career long of 56 yards, while the second was a 40-yarder to win the game as time expired.

"You live and learn on every kick, try to figure what you did wrong and apply that to future kicks," Dawson said.

"It doesn't matter how [we won]," San Francisco coach Jim Harbaugh said. "By any means necessary."

The teams combined for 16 points in the final 3:20.

After Dawson's 56-yarder put San Francisco up by 20-17 with 1:45 to go, Jay Feely - who had missed two earlier - made a 43-yarder to tie it at 20 with 34 seconds left.

That turned out to be plenty of time for the 49ers.

49ers 23, Cardinals 20

San Francisco 17 0 0 6 - 23

Arizona 0 7 0 13 - 20

First quarter

SF-FG Dawson 27, 10:37.

SF-Boldin 4 pass from Kaepernick (Dawson kick), 8:33.

SF-V.Davis 3 pass from Kaepernick (Dawson kick), :52.

Second quarter

Ari-Ballard 1 pass from Palmer (Feely kick), 4:46.

Fourth quarter

Ari-FG Feely 49, 14:47.

Ari-Roberts 34 pass from Palmer (Feely kick), 3:20.

SF-FG Dawson 56, 1:45.

Ari-FG Feely 43, :29.

SF-FG Dawson 40, :00.

A: 63,570.

SF   Ari

First downs 19   19

Total Net Yards 375   482

Rushes-yards 23-83   22-83

Passing 292   399

Punt Returns 3-45   1-2

Kickoff Returns 3-84   3-47

Interceptions Ret. 1-4   0-0

Comp-Att-Int 21-34-0   28-49-1

Sacked-Yards Lost 2-18   1-8

Punts 6-43.0   3-49.3

Fumbles-Lost 0-0   1-1

Penalties-Yards 4-20   3-30

Time of Possession 27:40   32:20

INDIVIDUAL STATISTICS

Rushing: SF, Patton 1-26, Kaepernick 4-24, Gore 13-14, Hunter 2-13, Boldin 1-11, Dixon 2-(minus 5). Ari, Mendenhall 10-47, Ellington 9-30, S.Taylor 2-7, Palmer 1-(minus 1).

Passing: SF, Kaepernick 21-34-0-310. Ari, Palmer 28-49-1-407.

Receiving: SF, Boldin 9-149, V.Davis 3-45, Crabtree 3-29, Patton 2-34, Dixon 2-27, Staley 1-14, James 1-12. Ari, Fitzgerald 6-113, Floyd 6-91, Housler 5-78, Roberts 3-74, Ellington 3-12, Mendenhall 2-13, Dray 1-18, S.Taylor 1-7, Ballard 1-1. Missed Field Goals: SF, Dawson 24 (WL). Ari, Feely 37 (WR), 43 (WR).