The former world number one showed no trace of rustiness against the Spanish qualifier as she opened with an ace and breezed to victory in 42 minutes.
"I definitely knew I'd been away," the American told reporters. "I haven't been around this atmosphere in a long time and I felt it.
"I had a few butterflies at the beginning but once I stepped on the court they were gone."
Williams, now ranked sixth in the world, was delighted to finish off Marrero so quickly.
"Who wants to play long matches?," she said.
Williams last played when beating sister Venus in the Wimbledon final in July. She underwent knee surgery in August before her return was further delayed by a family bereavement.
The top seed was barely out of the locker room before she had broken Marrero's serve and she wrapped up the first set against the world number 83 in 20 minutes.
Williams, who will play Elena Likhovtseva in the next round after the Russian defeated Czech Barbora Strycova 6-1, 6-4, said the date of her comeback had been based largely on medical advice.
"They didn't want me to come back too soon and ruin my chances of coming back at all," she said.
"At the end of the day it wasn't really my decision. It was mostly the doctors."
Fourth seed Jennifer Capriati, in only her third event of the season, cruised past Czech Klara Koukalova 6-0, 6-1 to secure a third-round berth.
CORIA UNTROUBLED
In the men's draw, third seed Guillermo Coria of Argentina was untroubled in his second-round match against South African Wayne Ferreira as he won 7-6, 6-0.
Seventh-seeded Briton Tim Henman was a surprise loser, however, as he went out 7-6, 2-6, 7-6 to world number 64 Juergen Melzer.
Henman, runner-up to Roger Federer in Indian Wells last week, struggled in the blustery conditions but served for the match at 6-5 in the third set, only to see the combative Austrian hit back in the tie-break.
"He raised his game right at the end and all credit to him," said Henman.
"He played some really good stuff out there. The conditions don't get any more difficult than that."
Melzer was understandably delighted.
"I feel great," he said. "You have to feel great after beating Henman, otherwise there is something wrong. It's huge."
Sixteenth-seeded American Mardy Fish was another shock loser on day three when he was beaten 6-4, 6-4 by French qualifier Julien Benneteau.
Marathon man Todd Martin of the U.S. came through another epic, winning his second straight three-setter against Finn Jarkko Nieminen 6-3, 5-7, 7-5.
Goran Ivanisevic retired injured from his match against Rafael Nadal when the Spaniard won the first set 6-4. The former Wimbledon champion felt pain in his troublesome left shoulder.
Lleyton Hewitt, seeded 17, wasted little time in sealing his place in the third round. The Australian demolished Robin Soderling of Sweden 6-4, 6-2.
World number one Federer's late-night match against Nikolay Davydenko of Russia was held over until Saturday after showers disrupted play for the third day in a row.