MONTREAL (AFP) - Russia's Maria Sharapova withdrew from the WTA Rogers Cup Wednesday just moments after winning a marathon second-round match over Marta Domachowska. The third-seeded Sharapova needed two hours, 56 minutes to beat the unseeded Domachowska of Poland 7-5, 5-7, 6-2 and then pulled out of the tournament with an injured right shoulder. "Coming into this tournament I wasn't sure if I was going to be able to compete," Sharapova said. "In the last few weeks I've been trying to find a solution to the aggravation I did to the shoulder back at Indian Wells in one of my matches. I haven't found the solution yet. "I just spoke to a couple of doctors and they advised me to try to find the cause of the problem, what's causing my bursitis, because they think there's something else behind it rather than just that." Sharapova was scheduled to play a third round match against Japan's Ai Sugiyama who was victory the win in a walkover. This was Sharapova's first match since her disappointing performance at Wimbledon. After splitting the first two sets, Sharapova stepped it up and dominated the third set against Domachowska. She won the first four games before her opponent got on the score board. They split the final four games of the match as Sharapova held serve in the eighth game to advance. Sharapova was upset in the second round at Wimbledon by countrywoman Alla Kudryavtseva. Sharapova is playing this hardcourt event for the first time since 2004, when she lost her opening match and fell to 1-2 at the Rogers Cup tournament. Top seed Ana Ivanovic played her first match since a sub-par Wimbledon and was tested by unseeded Czech Petra Kvitova before advancing 6-3, 4-6, 6-3. "It wasn't the best match I've played," Ivanovic said. "She played a match before this week and for me it was the first match since Wimbledon. "So in the beginning I obviously struggled to find my rhythm a little bit. But I'm happy I won. You have to win even if you don't play your best. That was the case for me today." Ivanovic connected on just 59 percent of her first serves and won 11 of 16 break chances. Ivanovic's No. 1 ranking actually came under threat this past weekend as countrywoman Jelena Jankovic had a chance to overtake her with a win at Los Angeles. A semi-final loss to Safina, however, crushed Jankovic's opportunity. Because she lost her first match in Montreal last season, Ivanovic is in position to pick up some ranking points this week and put some distance between herself and the other top five players. The parade of talent also included second-seeded Jankovic, who overcame a partisan crowd in a 6-0, 6-4 victory over Canadian Aleksandra Wozniak in the second round. Jankovic needed an hour to dispose of Wozniak, winning six of nine break-point opportunities. Sixth-seeded Russian Anna Chakvetadze advanced 6-2, 7-5 over Jill Craybas. Ninth seed Patty Schnyder, No. 11 Victoria Azarenka and No. 12 Nadia Petrova also are through to the third round. Sugiyama is the first to make it to the quarter-finals. Tenth seed Marion Bartoli of France advanced when her opponent, Alisa Kleybanova of Russia, withdrew with an injured back.Meanwhile, the WTA announced Wednesday that Jankovic and Ivanovic became the first two players to qualify for this year's Sony Ericsson Championships in Doha.