World number three Roger Federer is out of the Shanghai Masters after a 7-6 2-6 6-3 loss to Albert Ramos-Vinolas.
The defending champion was playing his first match since losing the US Open final to Novak Djokovic, having received a bye into the second round.
World number 70 Ramos-Vinolas, who has only won one Grand Slam match in the past three seasons, had never previously beaten a top-10 opponent.
The Spaniard will face Jo-Wilfried Tsonga or Victor Estrella Burgos next.
Get guaranteed lifetime income and reduced risks to retirees all here.