ANAHEIM >> As an offensive strategy, putting the ball in play against Kansas City Royals pitcher Jordan Lyles wasn’t getting the job done for the Angels on Sunday afternoon.

Putting the ball over the fence worked, but only in the sixth inning. That was all it took to spur a come-from-behind, 4-3 win over the Royals before an announced crowd of 36,016 at Angel Stadium.

Taylor Ward, Mike Trout and Shohei Ohtani all hit solo home runs in consecutive at-bats against Lyles, turning a 2-1 deficit into a 4-2 lead. The Angels (11-11) survived a late home run by Bobby Witt Jr. to win two of three games against Kansas City (5-17) to begin a seven-game homestand.

For Ward, the rally-starting homer was his third of the season and his first since April 3.

“Definitely boosted (my) confidence a little bit,” Ward said.

The Angels’ leadoff hitter was mired in a 4 for 34 slump when manager Phil Nevin elected to give him a day off Saturday, citing Ward’s lack of aggressiveness at the plate. Sunday, he swung at 8 of the 14 pitches he saw, all strikes. Only one landed over the fence, but it had a big impact on the game.

Ward also drew a walk in the first inning that led to the Angels’ first run.

“He’s not leading off to be Vince Coleman or Rickey Henderson,” Nevin said of Ward. “He’s leading off to put one in the seats and put somebody down 1-0. He’s also a great on-base guy. That’s fine, but I don’t want him to lose his aggressiveness.

“With those guys (Trout and Ohtani) hitting behind him, it’s great to have guys on base, but one point before they come up is big, too.”

The last time the Angels hit three consecutive home runs was June 8, 2019, when Tommy La Stella, Trout, and Ohtani did the deed against the Seattle Mariners.

Austin Warren (1-0) pitched 1 1/3 innings in relief of starter Reid Detmers to pick up the win. Detmers allowed two runs on seven hits in 5 2/3 innings, walking one batter and striking out six. He allowed a solo home run to MJ Melendez in the first inning and another to Vinnie Pasquantino in the sixth.

Both home runs came on breaking balls, but Detmers was pleased with his effort overall. He fell one out shy of completing six innings when a hard grounder to second base ate up Luis Rengifo and bounced into right field for a single, prompting Nevin to insert Warren.

Detmers threw 90 pitches, 61 for strikes.

“I made the pitches when I needed to,” he said. “It got me out trouble a lot of times. I felt pretty good today.”

On the heels of an 11-8 loss in which the Angels allowed five runs in the ninth inning, the bullpen offered a sigh of relief: only onee hit allowed in 3 1/3 inning, on Witt’s seventh-inning home run against Warren.

Matt Moore and Carlos Estevez followed Warren with one scoreless inning apiece. Estevez was credited with his third save of the season.

“I wanted to let (Detmers) loose and run further into the game, but I loved the way Warren matched up with Duffy, and that right-handed lane once (Hunter) Dozier came into the game for Melendez,” Nevin said. “It worked out well.”

Lyles (0-4) allowed only one hit and one run in the first five innings. Ward walked to lead off the game, went to third base on a ground-rule double by Trout, and scored on a sacrifice fly by Ohtani to tie the score 1-1.

Trout finished 3 for 4 and Ohtani went 2 for 3. Ward’s home run and a single by Zach Neto accounted for the Angels’ other hits.