Rafael Nadal
Rafael Nadal needed five sets to get passed 111th ranked Tim SmyczekGetty

Rafael Nadal avoided a shock second-round exit at the Australian Open after edging past Tim Smyczek in a five-set thriller.

The world number three sealed a dramatic 6-2 3-6 6-7 (2-7) 6-3 7-5 to avoid his earliest ever defeat at Melbourne, having to overcome stomach problems that struck in the third set.

Smyczek, ranked 112th in the world, recovered after losing the opening set and stood on the brink of victory on more than one occasion during an error-strewn performance from Nadal.

But the 28-year-old Spaniard sealed the victory after an exhausting four hours of tennis to progress at the expense of the American.

The 14-time Grand Slam winner assumed early control of the contest, moving into a 4-1 lead and showing no signs of the injury that marred his end of 2014 before sealing the opening set with a stinging forehand for his third break point.

But Nadal was instantly broken in the second, surrendering a double fault in the opening game. Smyczek, 27, broke his opponent again to take a 4-3 lead as he capitalised on a series of errors from the 2009 champion, who then gave away another double fault. An inch-perfect forehand down the line saw the American level the contest.

Nadal showed signs of fatigue in the third set, complaining of cramps and dizziness. His opponent took advantage of the Spaniard's vulnerability, breaking yet again with a terrific angled effort.

The Spaniard secured two break points for himself as he looked to have regained his composure but, with the perfect opportunity to put some daylight between himself and his opponent, he again squandered his chances through another double fault. Smyzek dutifully punished him for his error.

Three unforced errors from the American allowed a scowling Nadal to rescue another break point in the fourth set and prolong the contest. Nadal saw three break points slip by in the deciding fifth set but a flawless backhand and forehand strikes saw him secure a vital break in the 11th game.

Drama persisted until the very end as Nadal was pulled back at match point on three occasions but sealed it at the fourth attempt before sinking to his knees in celebration.

Earlier on Wednesday 21 January, Roger Federer sealed his passage to the next round, beating Italian Simone Bolelli in four sets despite suffering a mystery injury to his finger.