Losing streaks don’t go away easily, and the Texas Rangers are well aware of that.

That explains the collective sigh of relief once Joe Nathan got the final out Monday night, a popup by Derek Norris, preserving an 8-7 victory over the Oakland Athletics to open a four-game series between the top two teams in the American League West.

“What a great team win for everybody,” catcher A.J. Pierzynski said.

The win was badly needed for a team that had been on a six-game losing streak and had seen their one-game lead in the AL West turn into a three-game deficit in less than a week.

With the win, the Rangers are now two games back of the A’s in the division.

“We came back and played like Texas Rangers,” said Nelson Cruz, who had two home runs and four RBIs on the night. “No better time to do it than against our rivals.”

The night had plenty of drama from start to finish, beginning with the Rangers taking an early 3-0 lead and ending with the A’s stranding the tying run at second.

Pierzynski sent a two-run home run off the right-field foul pole in the second, snapping a string of 139 straight plate appearances without a homer by the Rangers. Ian Kinsler brought in another run in the third with a two-out single to score Leonys Martin, who led off the inning with a double.

But things took a turn for the worse in the fourth.

After three scoreless innings, starter Nick Tepesch gave up a leadoff double to John Jaso. Yoenis Cespedes then hit a grounder to third that bounced off Adrian Beltre’s leg and toward shortstop Elvis Andrus. Andrus came up with it and threw it back to Beltre to get Jaso going for third.

It appeared Beltre applied the tag in time, but Jaso was called safe. Tepesch didn’t respond well after that.

The next four batters reached, including RBI hits by Brandon Moss, Seth Smith and Jed Lowrie, as the A’s pulled ahead 4-3. They scored two more runs on a sacrifice fly by Eric Sogard and a single by Coco Crisp, which ended Tepesch’s night.

It felt like the Rangers were bound to stay in their June rut after that six-run inning, but they battled back.