SHANGHAI: Rafael Nadal failed to reach a quarterfinal for the first time this year after a shock defeat by Jurgen Melzer in the third round of the Shanghai Masters Thursday. The No. 1-ranked Nadal had never dropped a set to the Austrian in three previous meetings but went down 6-1, 3-6, 6-3. The Spaniard had most recently beaten Melzer in the semifinals of the French Open this year on his way to the title. Nadal won the US Open in September to become the seventh man in history to win all four Grand Slam tournaments and was bidding for his eighth title of the season in Shanghai. Melzer played aggressively from the start, hitting booming forehand winners and attacking Nadal's second serve to break the Spaniard twice and capture the opening set in 40 minutes. Roger Federer, Novak Djokovic and Andy Murray all had easier times Thursday. Federer, playing his first tournament since the US Open in September, was made to work hard before beating Italian Andreas Seppi 6-3, 6-4, to set up a quarterfinal against Robin Soderling. The No. 3-ranked Federer has a 13-1 winning record against the Swede, who defeated 11th-seeded David Ferrer 7-5, 6-4. Murray beat qualifier Jeremy Chardy of France 6-3, 6-4 to reach his ninth quarterfinal this year and book his place at the World Tour Finals in London. He'll face his first real test in the quarterfinals when he faces 12th-seeded Frenchman Jo-Wilfried Tsonga, who defeated Germany's Florian Mayer 7-5, 6-3. Djokovic, aiming to win back-to-back titles after capturing the China Open in Beijing last week, defeated Frenchman Richard Gasquet 6-1, 6-1. Djokovic next faces Spain's Guillermo Garcia-Lopez, who upset Wimbledon finalist and seventh-seeded Czech Tomas Berdych 7-6 (4), 6-3. Garcia-Lopez advanced Wednesday when Andy Roddick retired with a groin injury while leading 6-3, 2-3. Ivanovic wins In Austria, former No. 1 Ana Ivanovic was docked a game for taking too long in the toilet but still eased past Barbora Zahlavova Strycova of the Czech Republic 6-3, 6-2 to reach the Generali Ladies quarterfinals Thursday. Second-seeded Daniela Hantuchova, who won the event in 2007 on her last appearance, also advanced after defeating Carla Suarez Navarro of Spain 6-4, 6-3. Hantuchova will face Swiss veteran Patty Schnyder, whom she beat in that 2007 final. Ivanovic later revealed on her Facebook page she was getting sick after eating yoghurt just before the match. Ivanovic next meets Julia Goerges of Germany, who beat fifth-seeded Petra Kvitova of the Czech Republic 6-2, 6-1 to reach her fifth quarterfinal of the season. Goerges won her only WTA Tour title in nearby Bad Gastein in July. Schnyder, twice a runner-up in Linz, lost her serve in the opening game against Klara Zakopalova before routing the eighth-seeded Czech 6-2, 6-0. Eleni Daniilidou of Greece saved three set points before defeating Austria's Sybille Bammer 6-1, 7-6 (2). Daniilidou next plays sixth-seeded Andrea Petkovic. Peer advances In Japan, Israel's Shahar Peer overcame a slow start Thursday to defeat Japan's Ryoko Fuda 1-6, 6-1, 6-3 and advance to the quarterfinal of the Japan Women's Open. In other matches, seventh-seeded Iveta Benesova of the Czech Republic defeated Alberta Brianti of Italy 6-1, 7-5 and American Jill Craybas overpowered Olga Savchuk of Ukraine 6-1, 6-1. Kimiko Date Krumm routed Japanese compatriot Aiko Nakamura 6-2, 6-0 to set up a quarterfinal against defending champion and top-seeded Samantha Stosur of Australia.