ANAHEIM, Calif. (AP)Mets manager Buck Showalter had a consistent motto throughout their long trip to Southern California: They can only control what is front of them.

On Sunday, they made sure they were able to end it on a winning note.

J.D. Davis and Pete Alonso homered, Taijuan Walker struck out 10 and the Mets defeated the Los Angeles Angels 4-1.

Starling Marte had two hits and drove in a run in his return to the lineup, while Jeff McNeil had three hits for the Mets, who took two of three at The Big A to go 5-5 on their season-high 10-game trip.

”I knew it was going to be a challenge. I thought our guys responded well,” Showalter said. ”We had to make some adjustments and there will be another one around the corner.”

The Mets left New York with a 9 1/2-game lead in the NL East on June 2. They return with the National League’s best record at 40-22, but their division lead is down to 5 1/2 with Atlanta on an 11-game winning streak.

With the Braves on their best stretch since 2013, that’s why Showalter wasn’t fixated on the standings during most of the road trip.

”Coming out 5-5 isn’t the worst thing. We played a bunch of high quality teams. And we figured out a lot about ourselves, especially since we’re not at full strength,” said Alonso, who had two hits, including a solo shot in the ninth inning, and drove in two runs to extend his hitting streak to seven games.

Davis connected on an elevated fastball from Patrick Sandoval (3-2) and put it into the Mets’ bullpen in left field for a 2-1 lead in the fourth inning. It was only Davis’ second home run of the season, with the other coming April 24 at Arizona.

Davis has a .263 batting average, but he has produced at a .357 clip (20 for 56) with five RBIs over his last 16 games.

Walker (4-2), who had only 25 strikeouts in his first nine starts, posted his 10th career game with double-digit Ks. The right-hander had three strikeouts in the second and fourth innings, and also picked Brandon Marsh off first base in the third. He gave up one run on six hits in six innings.

Walker came in using his slider only 14% of the time, but he threw 22 against the Angels (23%) with 17 going for strikes. His fastball averaged 94.6 mph, which is slightly above his season average of 93.9.

The Angels got four hits in the first inning off Walker. He made an adjustment between innings and put his glove closer to his body and hardly moved it so he wasn’t tipping pitches.

”After that, I started getting swings and misses. I was being aggressive with the fastball, the slider was there early in counts,” Walker said.

Edwin Diaz got five outs for his 12th save. He had five strikeouts, including getting Trout to whiff on a 99.7 mph fastball in the eighth inning.

Mike Trout had an RBI single for the Angels, who lost five of seven during a homestand when Joe Maddon was fired as manager. Reigning AL MVP Shohei Ohtani was given the day off.

The Mets at one point retired 14 straight Los Angeles hitters. The Angels did not generate a hit after the fourth inning. They had two baserunners in the eighth inning via walks but were unable to generate anything.

The Halos struck out 16 times to tie a season high. It’s the sixth time this season they have been struck out at least 15 times.

”As the game goes on 4 p.m., it’s extremely difficult to see as a hitter and both starters threw pitches that make it tough,” manager Phil Nevin said.

Marsh led off the Angels’ first with a double to right field and scored on Trout’s hit to left.

Marte, who missed three games due to quad tightness, tied it in the third with an RBI double. Tyler Wade was playing center field with Trout as the designated hitter and came in three steps before the drive went over his head. The ball rolled to the wall, which allowed Brandon Nimmo to score from first.

Sandoval also went six innings and was charged with two runs and eight hits with eight strikeouts.

CALIFORNIA LOVE

Alonso leads the National League with 17 home runs, with five coming on the trip. He went deep three times at Dodger Stadium, the site of next month’s All-Star Game and Home Run Derby, and had a pair over the weekend at Angel Stadium.

TRAINER’S ROOM

Angels: OF Taylor Ward (mild right hamstring strain) is on track to come off the injured list on Tuesday after taking batting practice and running the bases Sunday.

UP NEXT

Mets: Off on Monday before returning home to begin a three-game series against the Milwaukee Brewers. Chris Bassitt will go in the opener (4-4, 4.35 ERA).

Angels: Open the Freeway Series against the Los Angeles Dodgers with two games at Chavez Ravine. Noah Syndergaard (4-4, 3.69 ERA) takes the hill Tuesday.

More AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports