LOS ANGELES — Finally, Dodger Stadium was quiet.

Minutes before the first pitch, for four straight days, public address announcer Todd Leitz practically screamed: “Now taking the field, your back-to-back world champion Los Angeles Dodgers.”

Seconds after the final out on Thursday, Friday and Saturday, Randy Newman’s “I love L.A.” began playing over Dodger Stadium’s cranked-up speakers.

On Sunday, as the afternoon turned to evening, the Padres’ soundtrack of misery was interrupted.

At the end of their weeklong road trip, they won.

After eight consecutive losses — including three in Chicago, where virtually everyone inside Wrigley Field sings “Go, Cubs, Go” after every victory by the home team, and then the three in L.A. — the Padres beat the Dodgers 5-2.

“Obviously you want to break the streak,” Manny Machado said “Want to get back home with a dub. I think we did a pretty good job with that today.”

Yes, Sunday’s victory halted the Padres’ longest losing streak in 13 years.

“Huge win for us, just to get off the losing streak and be able to talk about something good,” manager Craig Stammen said.

The Padres are a game under .500 with seven games remaining before the All-Star break and four weeks until the Aug. 3 trade deadline. Much regarding their deadline plans will be determined by what they do on the field beginning with the homestand that concludes the traditional “first half” of the season.

But they got what they needed Sunday, including five strong innings from left-hander JP Sears at the start.

Sears departed with the Padres ahead 1-0 after they scored in the fourth inning on a walk by Machado and a single by Gavin Sheets with one out and Xander Bogaerts’ two-out single.

Machado’s three-run homer punctuated a four-run seventh inning to put the Padres up 5-0.

At the end, after three other relievers limped through three innings, Mason Miller converted his first save opportunity in nearly two weeks.

All that followed a loud beginning to the game.

After Dodgers starter Emmet Sheehan’s second pitch, which first base umpire Ben May ruled Fernando Tatis Jr. had swung on, several people in the Padres dugout voiced their displeasure, home plate umpire Nick Mahrley turned and yelled for them to stop.

After the next pitch, a swing Tatis checked, there were more jeers, and they did not stop when Mahrley again turned to the dugout and yelled. Mahrley quickly ejected infield coach Ryan Goins, which brought Stammen from the dugout to “defend” his coach. The manager was ejected in relatively short order as well.

Stammen insisted he was “was not looking to get tossed, and I told the umpire not to toss me. He still did.”

Fernando Tatis Jr. was among the players who said he thought Goins, a longtime major league player, got ejected purposely.

Bench coach Randy Knorr and pitching coach Ruben Niebla were left to navigate a game with a bullpen thinned by injuries and a heavy workload.

Sears allowed his first with two outs in the fifth inning, and even though he had thrown just 76 pitches and the Padres bullpen has been taxed by injuries and workload, that was it for the left-hander.

“We had definitely mapped out the pitching in a strategic way, and he probably went a little further than we imagined,” Stammen said. “But he was just pitching so good, locating his pitches … and just keeping those hitters off-balance.”

Left-hander Yuki Matsui was brought in for the bottom of the sixth.

He retired No.9 batter Eliezer Alfonzo on a fly ball before walking Shohei Ohtani on four pitches and Andy Pages on five. He got another out on a fly ball to center field by Freddie Freeman before a run of right-handers prompted Knorr to walk from the dugout and motion for Bradgley Rodriguez.

The rookie right-hander ended the inning by getting Mookie Betts to hit a fly ball that was caught by Jackson Merrill in left-center field.

Rodriguez walked Teoscar Hernández to start the bottom of the seventh before striking out Alex Call.

The Dodgers sent left-handed Kyle Tucker to the plate as a pinch-hitter, and Knorr replaced Rodriguez with left-hander Adrian Morejón.

Singles by Tucker, Kyle Freeland and Shohei Ohtani got the Dodgers to 5-2.

Morejón got through the eighth to keep the ask of Miller to three outs, and he retired all three batters he faced to move into a tie for the National League lead with his 22nd save.

They could at least walk away having answered different questions and not having hear another celebratory song.

“We had a bad weekend in Chicago, we had a bad weekend here as well,” Machado said. “We finished it off with a dub. … This is a tough stretch for us, you know, and we put ourselves in a bad situation, but I think this is what baseball is made of.”