The last time San Francisco 49ers quarterback Colin Kaepernick faced the Green Bay Packers, he beat them with his feet, running for 181 yards -- an NFL rushing record for quarterbacks -- in a 45-31 victory in an NFC divisional playoff game in January.

In the rematch at Candlestick Park on Sunday, Kaepernick beat Green Bay with his arm.

Kaepernick threw for a career-high 412 yards and three touchdowns, lifting the 49ers to a 34-28 victory.

Kaepernick, who destroyed Green Bay's defense with read-option runs in January, spent most of the day playing catch with wide receiver Anquan Boldin. In his first game as a 49er, the former Baltimore Raven caught 13 passes for 208 yards and one touchdown.

"(Kaepernick) did exactly what he's capable of doing," Boldin said. "He did exactly what he needed to do. He's a quarterback first. Being able to run is just a bonus."

Kaepernick completed 27 of 39 passes, including two to tight end Vernon Davis for touchdowns. He had a passer rating of 129.4.

"I feel like there are more throws I should've made out there," Kaepernick said. "There were plenty of times I feel like I should've completed passes I didn't. That's something I have to get better at."

Boldin came within nine yards of matching his single-game career high for receiving yardage that he set in his NFL debut for Arizona on Sept. 7, 2003 at Detroit. Boldin caught his most passes in a game since grabbing 13 as a Cardinal on Nov. 16, 2008 against Seattle.

"You never know when your number is going to be called," Boldin said. "You never know when you're going to have that big game. You just have to be prepared."

Boldin caught six passes for 104 yards and a touchdown in Baltimore's 34-31 victory last season in the Super Bowl. The Ravens traded him to San Francisco over the offseason for a sixth-round draft pick.

"I think we got the better end of that deal," Kaepernick said.

With the Packers geared to stop Kaepernic's read-option runs, he carried just seven times for 22 yards and had an aerial duel with Green Bay quarterback Aaron Rodgers.

Rodgers threw for 333 yards and three touchdowns. He completed 21 of 37 passes and posted a passer rating of 102.6. Wide receiver Jordy Nelson caught seven passes for 130 yards and a score.

"I don't think we played our best game," Rodgers said, pointing to two turnovers. "We've got to do a little better."

The 49ers took the opening kick in the second half and drove 80 yards for a touchdown, Kaepernick hitting Davis on a 2-yard scoring strike to put San Francisco ahead 21-14 with 9:46 left in the third quarter. During the drive Kaepernick completed four passes to Boldin for 70 yards.

"He was very tough," Packers cornerback Sam Shields said. "My first time ever guarding him. He's real aggressive. He's very strong. I realized that today."

The Packers answered with Rodgers' 8-yard touchdown pass to Nelson with 3:48 remaining in the third. Lined up right, Nelson beat nickel cornerback Nnamdi Asomugha on a slant for the score.

Phil Dawson hit a 27-yard field goal with 14:17 left to play, giving the 49ers a 24-21 lead, but Rodgers marched the Packers 76 yards in eight plays for a touchdown. Rookie running back Eddie Lacy leaped into the end zone from 2 yards out, putting Green Bay ahead 28-24 with 8:26 left to play.

The 49ers answered quickly, driving 80 yards in five plays as Frank Gore bulled in for a 2-yard touchdown, putting San Francisco ahead 31-28 with 5:47 left. Kaepernick hit Boldin for 43 yards to the Green Bay 32, and running back Kendall Hunter gained 23 yards around right end to the 9. Gore gained 7 yards on first down and reached the end zone on his next carry.

Shields said he wasn't surprised by Kaepernick's ability to throw from the pocket.

"We knew that he had a strong arm," Shields said. "They changed up just like we had to change up. Everybody knew they did the little pistol (offense) thing, so I guess they changed up their little scheme or whatever and started throwing it."

The 49ers forced a quick punt then made on a long drive capped by Dawson's 33-yard field goal with 26 seconds left that extended their lead to 34-28.

The 49ers and Packers battled to a 14-14 tie in the first half.

The 49ers struck first, taking a 7-0 lead on Kaepernick's 20-yard strike to Davis with 2:52 left in the first quarter. Lined up right, Davis shot off the line, then angled sharply toward the right corner of the end zone, beating safety M.D. Jennings for an easy score to cap a 13-play, 83-yard drive.

Green Bay pulled even on Rodgers' 5-yard touchdown pass to Randall Cobb with 1:05 left in the opening quarter. The Packers marched 80 yards for the score, with Rodgers hitting Nelson for 31 yards on a deep strike and Lacy for 31 on a screen pass.