SEATTLE — The Oakland Athletics won their battle with the Tampa Bay Rays for an American League wild-card playoff spot Monday night.

And now they become the Rays’ best friend.

With just five games remaining after Monday’s 7-3 win at Seattle, the A’s (95-62) need help from the Rays and/or the Boston Red Sox if they are to pass the New York Yankees (96-60) for the AL’s first wild card.

That now becomes the A’s goal, with the holder of the top wild card earning the home-field advantage in the single-elimination game next week.

The A’s were able to stay within 1 1/2 games of the Yankees, winners earlier in the evening at Tampa Bay, despite knowing they had already clinched a playoff berth by virtue of the Rays’ loss.

The A’s will need a similar businesslike approach when left-hander Brett Anderson (4-5, 3.96) duels with Mariners righty Mike Leake (10-10, 4.10) in the second game of the series on Tuesday night.

Presumably, the Oakland clubhouse will have dried after a wild celebration following Monday’s win that assured the A’s first postseason appearance since 2014.

“This is not a surprise to anybody in our locker room,” A’s manager Bob Melvin gushed afterward. Oakland had finished 2017 with a 75-87 record, a full 10 games out of the final wild-card spot.

“We knew we had (the playoff spot) once the game started, but it was kinda cool to finish it off like this,” Melvin continued. “You want to do it the right way. You don’t want to lose and then go in there and celebrate. This is the way you want to do it.”

Jonathan Lucroy, Jed Lowrie, Khris Davis and Matt Chapman homered in Monday’s win, and now they’ll set their sights on Leake, who had shut out the A’s on two hits over eight innings on Aug. 15, two weeks before getting shelled for six runs and 11 hits in 4 1/3 innings in a rematch.

Chapman and Stephen Piscotty had first-inning home runs off Leake in a five-run explosion that helped produce a 7-5 victory at a point when the Mariners also were competing for a wild-card spot.

Leake has made seven lifetime starts against the A’s, going 1-2 with a 3.48 ERA.

Anderson matched Leake pitch-for-pitch for 7 2/3 innings in the Aug. 15 contest, leaving a scoreless game in the bottom of the eighth.

The Mariners went on to win the game 2-0 on a Dee Gordon home run in the 12th inning.

Gordon also homered, just his fourth of the season, in Monday’s loss. He’s gone 3-for-9 without an extra-base hit in his career against Anderson.

The 30-year-old has pitched brilliantly at Safeco Field in his career, going 3-2 with a 1.20 ERA in nine games, including eight starts.

He’s 8-4 with a 1.82 ERA overall against the Mariners in 18 meetings (17 starts).

The Mariners (85-71), who finish the season with four games against Texas, need to win five of their remaining six to reach the 90-win mark for just the sixth time in franchise history, the first time since 1997.