Mayer confirmed the pregnancy on her Twitter feed late Monday after it was reported by Fortune magazine, writing: "Another piece of good news today -- @zackbrogue and I are expecting a new baby boy!"
Mayer, 37, is arguably the most high-profile woman in Silicon Valley and a rare female CEO at one of America's largest firms.
Mayer disclosed her pregnancy to a Yahoo! search committee in late June, and said no one on the company board expressed any concern over hiring a pregnant chief executive, Fortune reported.
"They showed their evolved thinking," it quoted her as saying.
She said she would take just a few weeks of maternity leave and work through it, telling Fortune: "I like to stay in the rhythm of things."
The magazine said the Yahoo! board did make one adjustment for Mayer, electing to hold its September meeting in the company's hometown of Sunnyvale, California, rather than New York.
Mayer was Google's 20th employee and its first female engineer, and is widely credited with developing the now ubiquitous user-friendly interfaces used by Google's search engine, Gmail, Google Maps and Google News.
Last week, shareholders endorsed the struggling Internet firm's overhauled board of directors and called for a fresh plan to compete against rivals such as Google and Facebook.
Yahoo! has been trying to reinvent itself as a "premier digital media" company since the once-flowering Internet search service found itself withering in Google's shadow.
Get your daily dose of tech news, reviews, and insights, in under 80 characters on Gadgets 360 Turbo. Connect with fellow tech lovers on our Forum. Follow us on X, Facebook, WhatsApp, Threads and Google News for instant updates. Catch all the action on our YouTube channel.