New York: Anastasija Sevastova’s decision to return to tennis after an 18-month hiatus paid off handsomely on Wednesday as the Latvian sent world number three Garbine Muguruza packing at the US Open.

The 26-year-old Sevastova stepped away from the game in 2013 after battling injuries.

Since returning in 2015 she has worked her way up to 48th in the world, reaching two WTA finals this year, but she was taken by surprise when she saw herself heading up a night session on the cavernous Arthur Ashe Stadium court.

“It’s an experience,” she said, and one she made the most of, despite the rowdy fans and a top-flight opponent who made her Grand Slam breakthrough with a triumph at the French Open this year.

“It still hasn’t settled in,” said Sevastova who recorded her first career victory over a top-five player.

“I mean, I’m tired mentally and it’s late. Normally I go to sleep at this time.”

Sevastova recovered an early break to take the first set, then survived a late bout of nerves to finish off the 7-5, 6-4 victory.

Up 5-1 in the second, she had two chances to serve it out but Muguruza saved three match points before the Latvian broke her for the win.

“It’s amazing — on Ashe, a night match,” she said. “What’s going to be bigger?”

As for the hiccup at the end, Sevastova said, “I was shaking a little bit ... I had to solve my head, myself, all the thoughts — what could be, what could not. I am so happy.”

Sevastova was ranked as high as 36 in the world in 2011, but after a series of dispiriting back injuries she left the game in 2013, returning in 2015.

Upon her return she started small, focusing on ITF events and trying to qualify into the main draws of WTA tournaments.

Her runner-up finish in Mallorca in June marked her first WTA singles final appearance in more than six years — since a 2010 title in Portugal.

“It feels great, but it’s still not like I won the tournament,” she said. “It’s only the second round.

“Now it’s the third round in two days. Tomorrow I have to play doubles.”

With that in mind, Sevastova said, she would indulge in only moderate celebrations with her best friend and her mother, an English teacher who was due to depart for home on Thursday.

“We’ll maybe go somewhere. They will drink, I will watch,” she said.

Then she’ll turn her attention to third-round opponent Kateryna Bondarenko, another player who stepped away from the game and returned, in her case after having a child.

“Head-to-head is not good,” said Sevastova, who has lost all three of her meetings with the Ukrainian. “She’s a tough competitor. She hits the ball hard. I have to play a good game.”

The down-to-earth attitude doesn’t preclude a whiff of wonder at where she finds herself.

“I was speaking with my boyfriend, were talking like ‘Last year, you were in the quallies of the US Open. You were so pumped to be in the quallies, to have a chance to be again on that stage. I lost first round in quallies. This year playing on Ashe — life can be funny sometimes.”