Nick Kyrgios has sensationally retired from his first-round match at the Shanghai Masters mid-match.

The 22-year-old had just lost the first set in a tie-break against 45th ranked American Steve Johnson and was engaged in a battle with umpires over several contentious decisions against him.

Kyrgios had received two code violations for unsportsmanlike conduct and received a point penalty during the tie-break which was obviously not received well by the Australian.

He was heard telling his box that he would retire if he lost the set and made good on the threat moments later, seemingly due to his fury at the chair umpire.

The latest controversy comes a year after he was suspended for eight-weeks for tanking matches at the same tournament last year.

It comes just days after Kyrgios lost to world number one Rafael Nadal at the China Open where he looked to be finally turning over a new leaf.

Kyrgios took to social media to explain his bizarre actions, blaming a stomach bug and a shoulder complaint for the dramatic walk-off.

"I've been battling a stomach bug for the past 24 hours and I tried to be ready but I was really struggling on the court today which I think was pretty evident from the first point," a statement read.

"My shoulder started to hurt in the practice today which didn't help either and once I lost the first set I was just not strong enough to continue because I've not eaten much [in] the past 24 hours."

This latest emotional outburst will almost certainly get the attention of officials.

Johnson will now play Wi Di for a place in the Round of 16.