Andy Murray is out of the Shanghai Masters. Photo: Mark Schiefelbein/AP Photo

LONDON  Britain's Andy Murray had his run at the Shanghai Masters ended in the second round on Tuesday as he was edged out by Italian Fabio Fognini 7-6 (7-4), 2-6, 7-6 (7-2) in a three-hour thriller. 

Murray, still working his way back to full fitness after major hip surgery, had two chances to serve out the match at 5-4 and 6-5 in the third set but couldn't open up a match point.

Fognini rallied back and raced away in the deciding tie-break for a place in the third round. 

It did get heated between the pair in the final set after Murray complained about Fognini's conduct after he yelled when Murray was trying to play a shot at 5-5. As he was explaining to the umpire, Murray told Fognini to "shut-up." 

World number 12 Fognini will go on to face either American Taylor Fritz or Russia's Karen Khachanov in round three. 

Murray's fellow Briton Cameron Norrie is also out after he lost to third-seeded Russian Daniil Medvedev 6-3, 6-1 in 54 minutes. 

Meanwhile, Roger Federer advanced to the third round with a 6-2, 7-6 (7-5) win over Spain's Albert Ramos-Vinolas. 

The 20-time grand slam champion looked comfortable after breaking twice to secure the first set, but had to rally from 1-4 down in the tie-break to triumph in 86 minutes. 

"Serve was solid. I was hitting my spots and really was never in trouble there," Federer said. 

"He (Ramos-Vinolas) had his chances, but it was a nice comeback for me, and overall, I was very happy."

Murray and Fognini could not be separated until a tie-break in the first set despite both players earning two service breaks each. 

In the tie-break, Murray made two forehand errors at 5-4, the latter soaring wide out of play, to concede the lead after an exhausting trade-off. 

The three-time grand slam champion soon revived for a 5-2 lead in the second set as Fognini wilted through errors to see the match enter a third and final frame. 

Murray saw a match-winning opportunity with a break at 5-4 in the third after Fognini failed to reach a low shot before a second bounce. However, Fognini broke back immediately to restore level terms. 

A second chance quickly presented itself for Murray as the Scot secured another break at 6-5, but he couldn't close out the match on serve as a long return saw Fognini earn a winner-takes-all tie-break. 

The errors from Murray continued at the most crucial point as Fognini was afforded a 6-1 lead. 

Murray saved one match point but left himself too much work to do as his final shot in Shanghai was a netted forehand after another tiresome effort. 

Earlier, American John Isner progressed to the second round of the Shanghai Masters after easily dispatching Australia's Alex de Minaur in a 7-6 (7-1), 6-4 victory. 

The 34-year-old fired down 18 aces as he triumphed in one hour and 21 minutes in China. 

He will next play Frenchman Lucas Pouille who eliminated Chinese wildcard Li Zhe 6-7 (4-7), 6-4, 6-4. 

Another American Reilly Opelka is through to round two after he defeated Serbia's Dusan Lajovic 6-3, 6-4 to face Spain's Roberto Bautista-Agut next. 

Russian Andrey Rublev progressed with a 6-4, 7-6 (7-4) win over Croatia's Borna Coric and he will meet Australian John Millman, who brushed aside Argentine Guido Pella 6-3, 7-5. 

Georgian Nikoloz Basilashvili surpassed France's Benoit Paire 6-4, 1-6, 6-1. 

The race to London's ATP Finals is a key objective for some players in Shanghai and Italy's Matteo Berrettini has a slight chance after beating German Jan-Lennard Struff 6-2, 6-1. 

Berettini is ranked 11th in the race rankings, three spots shy of the final eighth spot occupied by Alexander Zverev, who plays on Wednesday. 

Frenchman Gael Monfils' hopes were ended after he was beaten by Poland's Hubert Hurkacz 6-2, 7-6 (7-1). 

dpa