LOS ANGELES — Those embarrassing pajamas masquerading as big-league uniforms have thankfully vanished just as the Yankees sent a very loud message to the baseball universe that they are capable of playing deep into October.

And if that results in a World Series date with the Dodgers, so be it.

When the Yankees arrived in Hollywood, they were on a four-game losing streak that ended Friday night.

After Sunday’s crisp 5-1 win in front of 53,828 at Dodger Stadium, the Yankees headed to Seattle with two wins in three games against a club considered by many to be the best in baseball. And had umpire Gabe Morales not botched timeout protocol Saturday, the Yankees might have swept the defending NL champs.

The Yankees’ enthusiasm during these three interleague games was easy to detect and nobody uttered the “It’s just another game’’ cliché.

“I don’t think there is any question guys were excited to come play here against a great team in a great venue,’’ Aaron Boone said after watching Domingo German recover from Joc Pederson hitting his first pitch of the game for a homer, and DJ LeMahieu, Aaron Judge and Mike Ford homering against Clayton Kershaw. “I thought the guys really performed and delivered kind of all weekend. They love these environments and it was good to see them all contribute in a big way.’’

Kershaw subscribes to the theory that solo homers won’t bury you, but admitted there is a limit.

“I always said solo home runs won’t beat you, but three probably will. You can probably live with one or two, but three is too many,Just try and keep it in the ballpark next time,’’ said Kershaw, who dropped to 13-3.

Paced by German (17-3) allowing only one run and five hits in six innings, the Yankees understood the magnitude of taking two of three.

“It’s huge. They are the best team in the NL,’’ said Judge, whose third-inning home run broke a 1-1 tie and was his 16th of the season, third in three gamesand fourth in six . “That was a good test, a fun series. You could feel that it was a playoff atmosphere. Love that as a player.’’

Ford hit for Didi Gregorius in the third after the shortstop left the game due to a right shoulder contusion he suffered when Kershaw drilled him with a pitch in the first inning. Ford popped up in that at-bat but faced with a lefty-on-lefty situation in the sixth Ford sent the first pitch into the right-field seats. He added an RBI double in the eighth.

“It was awesome. I grew up watching [Kershaw] for many years,’’ Ford said.

Combined with the second-place Rays losing to the Orioles the Yankees’ AL East lead surged to nine lengths and they are one game back of the Dodgers in the race for baseball’s best record. The reward for that is home field in the postseason for as long as the winner advances.

Not only did German give up a homer to Pederson, Max Muncy followed with a double. But German knew he had to get his jumpy nerves under control.

“The first inning was tough for me. I was very excited to pitch here. A little too excited,’’ said German, the AL leader in wins. “I told myself to slow down and don’t worry about anything.’’

Muncy said he was impressed with German and noted the thermometer thin right-hander had some help late in the outing.

“He was pitching really well. He was good through the first couple of innings, except for the pitch to Joc, and once the shadows started creeping in, he was even better,’’ Muncy said.

The Yankees, who defeated Kershaw and Hyun-Jin Ryu in the series, have 30 games remaining before the ALDS opens and questions about the rotation remain. The health of Luis Severino, Dellin Betances, Giancarlo Stanton and Aaron Hicks are big issues.

Yet without anything from them, the Yankees walked into Dodger Stadium and took two of three from the hosts which can only help the visitors if they see the Dodgers in October.

After watching the way the Yankees handled everything across three nights the thought of a Yankees-Dodgers World Series is a lot closer than it was after they were swept by the A’s last week.