BOSTON — It’s safe to say that Boston Red Sox Manager Alex Cora knew what he was doing when he told Xander Bogaerts in spring training that he needed to hit for more power and production.

Bogaerts, 25, homered in each of the first two games of the weekend series against the Houston Astros to tie his career high of 21. On Sunday he went 4 for 4 – a night after getting three hits – to raise his batting average to .291. Bogaerts has posted career highs of 41 doubles and 93 RBI, leading all shortstops in those categories.

And there are still three weeks left in the regular season.

Cora met with Bogaerts, Mookie Betts and Jackie Bradley in spring training to tell them they were no different than Carlos Correa, Jose Altuve and Alex Bregman, the three young star infielders for Houston, and he wanted them to be more confident in themselves.

Cora remembered the opposite-field home run Bogaerts hit off Charlie Morton in the playoffs last year.

“I was like, ‘Wow, that’s impressive,’ ” said Cora, who was the Astros’ bench coach in 2017. “And I felt that there was more in there and I challenged him. Those (Houston) guys, they show up every day, they want to be great every day. You can do the same thing.”

This year Bogaerts is outperforming Correa. The Houston shortstop missed six weeks with a bad back and is hitting only .242 with 14 home runs and 62 RBI, quite a drop from a year ago when he hit .315 with 24 home runs and 84 RBI.

“Obviously he’s a great player,” Bogaerts said of Correa. “He is who he is and I am who I am. We’re both on good teams that are hopefully bound for the playoffs. I’m just here to help my team and focus on me helping.”

Cora didn’t have a hard time convincing Bogaerts to change his approach to hitting. He simply asked him who would become a free agent first after the 2019 season among this group of young, star shortstops: Bogaerts, Correa, Francisco Lindor of Cleveland or Corey Seager of the Dodgers.

“He tells me, ‘It’s me,’ ” Cora said. “I say, ‘Well you’re going to set the market, huh?’ and he smiles. He knows he’s a good player and we challenge him to hit fifth. We want him to drive the ball and he’s been doing that.”

Actually, Bogaerts has hit cleanup lately and he homered for the second straight game Saturday.

“No, I’m not actually surprised,” Bogaerts said. “It’s just what I wanted to do, I guess. Either you want to have three hits in a game to right field, three ground balls to right field, or you want to try to hit the ball with more authority. It’s basically up to you to choose what type of player you want to be. I do prefer this.”

Bogaerts’ peers have noticed the change. Cora remembers how Lindor reacted when Bogaerts homered against Cleveland last month,

“Francisco is like, ‘Wow,’ ” Cora said. “They look up the numbers and they’re impressed. The other night when he hit a home run to straight center, you see (Correa) and (Altuve) looking like, ‘That’s amazing,’ and then he goes deep (Saturday), and then they look at the numbers. You can see, they know, they know he’s a good player and I’m glad he’s having a good season.”

Bogaerts’ .534 slugging percentage, .880 OPS and 0.53 walk-strikeout ratio entering Sunday would also be career highs. His boost in production hasn’t come at the expense of his batting average. He’s hitting 18 points higher than last year, when his production fell over the second half of the season after being hit by a pitch in the hand.

Even before his hand injury, Bogaerts was known for tailing off after getting off to his fast starts. In 2016 he hit only .219 in August, and .241 in September and October, but this season he hit .303 in August and is hitting .461 in September.

In his last 26 games before Sunday, Bogaerts was hitting .330 with 14 runs, nine doubles, a triple, five home runs and 24 RBI.

Bogaerts has been at his best with runners in scoring position, hitting .349 entering Sunday with a .437 OBP and a .729 slugging percentage in those situations.

Those are a lot of numbers but here’s one more than might get overlooked: In 122 games, Bogaerts has committed only eight errors.

“I don’t think a lot of people talk about his defense,” said Red Sox utility man Brock Holt, “because of what he means to us offensively. But he’s a really good defensive shortstop and he’s proven it this year.”