HOUSTON — Had Jon Berti been able to get here with enough time to take a deep breath, Oswaldo Cabrera might not have been in the Yankees’ lineup on Thursday.

But Berti, acquired in a trade from the Marlins on Wednesday afternoon to fortify the Yankees’ infield depth, arrived at the team hotel at 2 a.m. Thursday.

So Aaron Boone decided to let Berti get settled and instead started Cabrera at third base against Astros left-hander Framber Valez.

Oswaldo Cabrera belts a game-tying solo homer in the sixth inning of the Yankees’ 5-4 win over the Astros.Charles Wenzelberg / New York Post

It helped the Yankees pull off the Opening Day win.

After singling and scoring off Valdez in the fifth inning, Cabrera smacked a game-tying home run off reliever Rafael Montero in the sixth on the way to the Yankees’ 5-4 win over the Astros at Minute Maid Park.

“Super fired up for Oswaldo because he’s been working his tail off to get it going here these last few weeks of spring and he has,” Boone said.

Cabrera started at third base for DJ LeMahieu, who is on the injured list to begin the season and does not yet have a clear timetable for a return.

The Yankees will try to hold the fort down in his absence with a combination of Cabrera and Berti, but Cabrera made his case for how he can help on Thursday.

The switch-hitting Cabrera will bat left-handed against some lefties this season. But he started off with a difficult assignment Thursday, batting right-handed against the tough, left-handed Valdez.

After striking out in his first at-bat, Cabrera hit an infield single up the middle off Valdez in the fifth inning to help fuel a three-run rally.

Then in the sixth, he took Montero deep on an inside slider to tie it up.

Oswaldo Cabrera (right) celebrates with Juan Soto after hitting a solo homer in the Yankees’ win over the Astros.Charles Wenzelberg / New York Post

The home run was reminiscent of the kind of swings Cabrera got off late in the 2022 season upon his arrival to the big leagues, the kind that was too often missing during his brutal 2023.

The key, according to Cabrera, is not trying to hit home runs.

“That’s what I’m working on right now: don’t try to be the power hitter,” he said. “We got all the power hitters around me, so right now I’m just trying to put the ball in [play] and try to make good contact.”

Cabrera had gotten off to a tough start offensively in spring training before finishing strong.

Still, the Yankees traded for Berti on Wednesday to better protect themselves without LeMahieu, with the former Marlin having the potential to nab starts at third over Cabrera.

For now, Cabrera wasn’t resting on the laurels of his home run.

“I felt that swing that I want to [have] right now,” Cabrera said. “That happened already. The game today is over, so we have to focus on the game [Friday].”