MADRID — Maria Sharapova avoided an early exit from the Madrid Open on Tuesday, rallying to beat Christina McHale to reach the third round.

Trailing 4-1 in the final set, Sharapova steadied her erratic service game and took command again to beat the 56th-ranked American 6-1, 4-6, 6-4 on clay at the Magic Box tennis center.

The ninth-ranked Russian looked to be cruising before McHale broke late in the second set to tie the match and then took her commanding lead in the final set after breaking Sharapova.

However, Sharapova didn’t surrender a point after that as McHale netted to be broken to see her advantage dip to 4-3, and Sharapova eventually fired an ace down the middle to eliminate McHale for the second year running.

“After a really good start (in Madrid) I didn’t keep that level. I think I had a bit of a letdown,” said 2013 finalist Sharapova, who is coming off a tournament victory in Stuttgart.

Earlier, Li Na continued her recent dominance of Zheng Jie by easing into the third round 6-2, 6-3 for her fourth straight victory against her fellow Chinese player. Zheng hasn’t won a set from the second-ranked Li since her last victory in 2006.

Lucie Safarova of the Czech Republic also advanced with a 6-1, 6-2 win over Magdalena Rybarikova of Slovakia, while American Sloane Stephens was also a winner.

Federer has twins ... again

MADRID — Roger Federer withdrew from the Madrid Open on Tuesday to welcome the birth of his second set of twins.

Federer said on his webpage early Tuesday he was pulling out of the tournament “to be with my wife Mirka during these next few exciting weeks for our family.”

The fourth-ranked Swiss player, who already has twins, said he would “rejoin the tour soon.”

Later, Federer tweeted: “Mirka and I are so incredibly happy to share that Leo and Lenny were born this evening! (hash)TwinsAgain (hash)Miracle”

Federer’s agent, Tony Godsick, confirmed to The Associated Press that the baby boys were born in Zurich, Switzerland, on Tuesday. Federer and his wife Mirka are already parents to twin daughters.

Federer had said last month he was prepared to skip tournaments to be with his wife when she gave birth.

The 32-year-old Federer did not specify if he would return for the Rome Masters next week, but Godsick said the 17-time Grand Slam champion intended to enter the French Open, which begins May 25.

“Roger has plans to play the French Open, and he’ll take it step-by-step as to what he plays before that,” Godsick said in a telephone interview.

Federer, a three-time winner in Madrid, hasn’t missed a Grand Slam tournament since 2000.

Federer’s 28-5 record on the season is the ATP’s best, with the former No. 1 having won a title in Dubai.

Polish player Lukasz Kubot took Federer’s place in the Madrid draw, and will face Gilles Simon of France in a second-round match.

Thiem KOs Wawrinka

Austrian qualifier Dominic Thiem scored the biggest victory of his young career on Tuesday when he rallied for a 1-6, 6-2, 6-4 victory over third-ranked Stanislas Wawrinka at the Madrid Open.

The 20-year-old Thiem showed composure beyond his years in knocking the Australian Open champion out of the clay court event to reach the third round.

Thiem called on a thunderous array of baseline strokes and soft net touches to oust the third-seeded Wawrinka, who reached the final at Madrid’s Magic Box tennis center last year.

Wawrinka wasn’t the only Swiss player to exit the tournament on Tuesday.