The two-time Australian Open champion, who gave birth to Leo in December, won 6-3 4-6 7-6 (9-7) against Japan's Risa Ozaki at the Mallorca Open.
It was the 27-year-old Belarusian's first match since losing at the French Open in June 2016.
Azarenka was sixth in the world when she announced her pregnancy last July.
She was a game away from defeat when play was suspended on Tuesday because of fading light.
Find out how to get into tennis in our special guide.
But she showed her trademark resilience to twice break 74th-ranked Ozaki's serve when they returned on Wednesday, then going on to fight back from 5-3 down in the tie-break.
Azarenka was given a wildcard to play in the Mallorca Open, which is scheduled to be her only competitive action before Wimbledon.
The former Wimbledon quarter-finalist has used her protected ranking to play at the All England Club in the tournament which starts on 3 July.

Colin Lochrie, 31, targeted the aircraft on 28 November 2013, causing the pilot to take evasive action.
He was caught after officers were alerted and traced Lochrie to his home in the city's west end.
Glasgow Sheriff Court heard that the aircraft was piloted by Captain David Traill the day before he died in the Clutha crash. Nine others also died.
Jailing Lochrie, Sheriff Bill Totten told him: "I wish to emphasise that this is not a case in which Mr Lochrie made a deliberate attempt to impair the pilot's vision."
He told him that he did deliberately shine the laser beam at the helicopter and has accepted his guilt and "there is a clear need to punish anyone who commits this serious crime".
Lochrie was jailed for 14 months, reduced from 18 months for pleading guilty.
The court heard that the helicopter was targeted at about 16:45 while returning from a task in the Dumbarton area.
As it flew over the west end of Glasgow, the pilot and crew, Constables Niall McLaren and David Graham, became aware of the green laser light beam being directed towards the helicopter.
The light beam repeatedly illuminated the cockpit and the court was told that Captain Traill took evasive action to avoid his vision being impaired.
Footage from the police helicopter was played to the court showing a green laser light being repeatedly shone towards the cockpit.
Information about the incident was passed to officers who were on foot patrol locally.
They were able to identify a particular room within a tenement block at Cecil Street in the west end of Glasgow.
Lochrie answered the door to the police and told them: "I was shining the laser at the helicopter because I wanted to see what it was doing.
"It wasn't meant to put people in danger"
He handed over the laser pen and was arrested.
The court heard that Lochrie bought the pen from an online retailer and used it when he occasionally gave some lectures to friends in relation to Zen Buddhism."

Trading Standards officers working with sniffer dogs uncovered the illicit haul at six properties in the Freeman Street area of the town.
The cigarettes and tobacco would cost an estimated Â£200,00 if bought legally.
North East Lincolnshire Council's Trading Standards team said it was the largest haul since it began a crackdown on illicit products last year.
Prior to the latest haul, the team seized nearly 90,000 cigarettes and 181lbs (82.5kg) of tobacco since launching Operation Nightshade.
Councillor Terry Walker said: "This is the most significant stash to have been uncovered during Operation Nightshade and is the result of a long-term, intelligence led campaign aimed at dishonest retailers who persist in flouting the law."
Former world number one Victoria Azarenka saved three match points before winning on her comeback from a year out after the birth of her son.
[NEXT_CONCEPT]
A man who admitted shining a laser pen at a police helicopter flying over Glasgow has been jailed for 14 months.
[NEXT_CONCEPT]
About 300,000 counterfeit and illegally imported cigarettes and 330lbs (150kg) of tobacco have been seized in Grimsby.