Rivera's shot over the left field wall came off reliever Guillermo Mota (3-2) in the eighth inning.
James Loney and Rafael Furcal homered for the Dodgers.
Justin Speier (3-1) got the last out of the eighth and Brian Fuentes got his AL-leading 19th save by striking out Casey Blake and Matt Kemp to end it.
More than 44,000 packed the stands to watch the crosstown rivalry. The Dodgers (44-24) have the best record in baseball and the Angels extended their winning streak to a season-high seven games.
Joe Saunders gave up four runs on six hits in 6 1-3 innings, including a bases-loaded walk to Casey Blake in the third before giving up a solo shot to Loney in the fourth and a two-run homer to Furcal one inning later that put the Dodgers up 4-1.
Maicer Izturis hit a two-run single off Chad Billingsley and Mike Napoli hit a sacrifice fly to tie it in the sixth before Erick Aybar grounded out to end the inning.
The bullpen did the rest, though not without drama. Speier came on with men on first and second in the eighth and walked Mark Loretta before retiring Juan Pierre on a foul to left.
Billingsley, attempting to become the NL's first 10-game winner, gave up four runs on six hits.
Blake had two spectacular grabs at third base. He made a barehanded pickup to start a 5-3-6 double play that ended with Chone Figgins being tagged out at third end the first and made a diving catch in foul territory to get the Dodgers out of a bases-loaded jam in the following inning.