Machado's homer was one of three by the Dodgers in the game, giving them a National League-leading 222 on the season and breaking the club record of 221 set last year.
The Dodgers' division lead remained 1 1/2 games ahead of Colorado, which won 5-1 at Arizona.
Rich Hill became the Dodgers' first 10-game winner, allowing one run and four hits in seven innings. The left-hander (10-5) struck out seven and walked none.
Hill has been stellar since the All-Star break with an 8-1 record. In his 12 second-half starts, the Dodgers are 9-3.
Machado caught a nice toss from his wife Yainee Alonso in the pre-game first pitch ceremony.
Then reminiscent of Manny Ramirez (2009) and Yasiel Puig (2015) homering on their bobblehead nights, Machado launched his 36th long ball of the season to right-center on the first pitch from Jacob Nix (2-4). Machado had 24 homers with Baltimore before being traded on July 18.
Fans responded with chants of "Manny! Manny!"
The Dodgers batted around in the third, when Justin Turner doubled down the left-field line to drive in a pair of runs. Machado's shot scored Turner and Max Muncy, who was hit by Nix, giving the Dodgers a 6-0 lead.
San Diego's first run came on Hunter Renfroe's 25th homer with two outs in the sixth, leaving him one shy of tying his career high set last year.
The Dodgers' bullpen struggled in the ninth.
After getting a quick out, Yimi Garcia allowed a double to Austin Hedges. Tony Cingrani came on and hit Eric Hosmer before giving up a single to Wil Myers that loaded the bases. Manuel Margot followed with an RBI single.
That forced manager Dave Roberts to bring in closer Kenley Jansen, who struck out the final two batters to earn his 37th save.
Rookie Nix gave up six runs and six hits in 2 1/3 innings. He struck out two and walked none.
LHP Joey Lucchesi (8-8, 3.74 ERA) goes for the Padres in the series finale. The third straight rookie to start in the series, Lucchesi is 0-2 with a 5.00 ERA in two starts against LA. LHP Hyun-Jin Ryu (5-3, 2.18) starts the Dodgers' last home game before they end the regular season on the road. Ryu has given up three earned runs in 11 2/3 innings of two starts against the Padres.