It was the fourth consecutive win for the Packers (8-4), solidifying their spot in the NFC wild-card race. But it certainly wasn't pretty.
The teams committed 23 penalties for 310 yards, tying for the second-highest yardage total in an NFL game.
The Ravens (6-6) struggled in coverage without star safety Ed Reed, who sat out with hip and ankle injuries.
Baltimore rallied for two touchdowns in the span of 30 seconds to cut Green Bay's lead to 17-14 after three quarters.
Joe Flacco, who had been bothered by a right ankle sprain, finally got Baltimore on the board with 3:28 left in the third quarter on a 12-yard TD pass to Kelley Washington to punctuate an 11-play drive after Donald Driver's fumble.
On the ensuing kickoff, Packers offensive lineman Evan Dietrich-Smith caught a short kick but fumbled, and officials pointed toward the Ravens before referee Walt Anderson apologized, saying, "Correction, my error, Green Bay recovered."
On the next play, Rodgers' pass deflected off Driver's leg and into the arms of linebacker Jarret Johnson.
Flacco then went for it all, and Packers cornerback Tramon Williams was flagged for pass interference on Demetrius Williams in the end zone, costing Green Bay 41 yards.
With the ball on the 1, Willis McGahee scored two plays later to make it 17-14 with 2:58 left in the quarter and capped it with an abbreviated Lambeau Leap as Packers fans pushed him back down.
Green Bay built a 17-0 lead on two TD drives late in the first half engineered by Rodgers, who went 26 of 40 with 263 yards and two interceptions.