Roger Federer was relieved to "hang tough" and weather the storm after seeing off compatriot Stan Wawrinka to reach the Cincinnati Masters semifinals.

The 20-time grand slam champion, who secured a 6-7 (2-7) 7-6 (8-6) 6-2 victory over his fellow Swiss, was pleased to get his reward despite not being at his best just over a week before the US Open gets under way.

READ| Djokovic and Federer join Cilic, Goffin in Cincinnati semis

"I just tried to remember [for] the core of the match, focus on your serve and try to do what we talked with the coach beforehand on the return games, but it was just never really connecting at the right times my way." said the world number two.

"So I just had to hang tough, not get frustrated, and hope that I was not going to throw in a horrible service game or that he was going to connect perfectly. It was a close match today, so I'm just relieved that I got through it somehow."

Wawrinka feels he is making strides ahead of the final major of the year at Flushing Meadows.

He said: "For sure it was a great level. I think I'm playing great in general. I'm playing better every day, every week. Last week [when he reached the third round of the Rogers Cup] was really important and really good for myself, for my tennis, for my confidence….

"I'm happy to see where I am right now. I had a tough match last week against Rafa [Nadal]. Close match, also. Today was against Roger. They are number one and number two in the world. I beat [Diego] Schwartzman, I beat [Kei] Nishikori, so the level is good.

“I need to keep improving, keep working, keep doing the right thing and keep pushing myself. For sure I'm sad and disappointed to lose, but for me it's a big victory for myself after what I had last year. It was exactly one year ago. To see where I was also a few weeks ago, I'm really happy to be here."