Madrid, Spain, 11 May 2017 | AAP

For the second year in a row Romanian Simona Halep has knocked Australia’s Sam┬áStosur out of the Madrid Open.

This time the third seed needed just under two hours to beat the Australian 6-4 4-6 6-4 and advance to the quarterfinals of the tournament she won last year.

For Stosur it was a hit and miss performance. When she stepped up into the court and hit deep she invariably made Halep pay but in the first and third sets there were simply too many unforced errors to go with her winners.

The match opened in the worst way possible for the Australian, with Halep breaking her serve and Stosur couldn’t peg that back.

In the second set it was Stosur who broke early to take a 2-0 lead, which she gave back immediately as a desperately defensive Halep rallied to make some impossible shots.

Stosur, who was imposing her will on Halep’s second ball, taking seven of eight points on it throughout the set broke again to go up 5-4 before serving it out to send the match to a decider.

The two women traded shaky service games early on until Halep got Stosur to 0-40 in the fifth game, broke her and then closed out the match calmly.

In a match that was tight the whole way Halep credited her game plan and mental strength for getting her over the line.

“I was very confident when the third set started. I knew that before the match it was going to be a very tough one,” Halep said.

“I think you saw how she served today. She’s an amazing player. She’s very strong but I think I was strong enough to stay there also with my body, not just mentally.

“I felt that mentally I am a little bit higher in this match. She played really well today.”

Halep will now play American world No.20 Coco Vandeweghe in the quarters after Vandeweghe came back from a set down to defeat Spaniard Carla Suarez Navarro 5-7 6-4 7-5.