McMahon entered the game in the fifth when Arenado was taken out with soreness in his right shoulder. McMahon lined a fastball from reliever Zac Rosscup (0-1) to straightaway center and heartily celebrated as he rounded first.
McMahon's homer overcame a rough night on the bases for the Rockies, who had two runners thrown out at home trying to score on grounders. Running on contact, Carlos Gonzalez was easily thrown out in the first and Trevor Story in the third.
The bullpen finished things off a day after giving up five homers and seven runs. The relievers went a combined 3 1/3 scoreless innings after starter Jon Gray left, with Jake McGee (2-4) picking up the win and Adam Ottavino closing out the ninth instead of a struggling Wade Davis. It was Ottavino's fifth save.
DJ LeMahieu had a two-run homer in the first to help the Rockies snap a six-game skid against the Dodgers at Coors Field. It was his first homer since June 28.
There was reason for a degree of concern with the durable Arenado leaving the game. The Gold Glove third baseman may have tweaked his shoulder while turning a double play in the third inning. He was covering second base on a play that was scored 3-5-3.
McMahon replaced Arenado at third base and hit his first homer since June 20.
Max Muncy had two doubles and a two-run homer for the Dodgers, while Cody Bellinger added three singles. Los Angeles remains in a first-place tie with Arizona in the NL West.
Kenta Maeda went 5 1/3 innings and allowed three runs before running out of steam and was replaced by Rosscup, a reliever Los Angeles claimed off waivers from Colorado on July 11.
Gray allowed four runs over 5 2/3 innings in a no-decision. It ended a streak of four straight quality starts since the right-hander was recalled from Triple-A Albuquerque.
Dodgers: Closer Kenley Jansen was placed on the 10-day disabled list Friday because of an irregular heartbeat. Manager Dave Roberts didn't have a timetable for his return.
Rockies: LHP Mike Dunn (left shoulder joint inflammation) tossed a recent bullpen session. ... RHP Antonio Senzatela (shoulder) threw on the side Friday and ''feels good,'' manager Bud Black said.
ROCKIN' IN THE CAGE
Singer Chris Stapleton took batting practice off Black before the game. Kershaw, Ian Desmond and Charlie Blackmon stood around the cage to watch.
Stapleton hit a sharp single to left on his first pitch and then got jammed on the next two pitches before calling it a day. Asked if he hit any homers, Stapleton responded: ''An inside the park one.''
He was playing at the Pepsi Center later Friday.
Dodgers: RHP Walker Buehler (5-4, 3.63 ERA) faced the Rockies on June 2 at Coors Field, giving up four runs in five innings.
Rockies: LHP Kyle Freeland (10-7, 3.04 ERA) is 7-2 with a 2.18 ERA in 10 starts at Coors Field this season.
More AP baseball: https://apnews.com/tag/MLBbaseball and https://twitter.com/AP-Sports