SUNNYVALE, Calif. (AP) — As a top executive at Google for the past 13 years, Marissa Mayer played an instrumental role in developing many of the services that have tormented Yahoo as its appeal waned among Web surfers, advertisers and investors.

AP/Courtesy

Marissa Mayer

Now, Yahoo is turning to its longtime nemesis to fix everything that has gone wrong while Google Inc. has been cementing its position as the Internet's most powerful company.

Mayer, 37, will tackle the imposing challenge Tuesday when she takes over as Yahoo's fifth CEO in the past five years.

The surprise hiring announced late Monday indicates Yahoo still believes it can be an Internet innovator instead of merely an online way station where people pass through to read a news story or watch a video clip before moving on to more compelling Internet destinations.

"I just saw a huge opportunity to have a global impact on users and really help the company in terms of managing its portfolio, attracting great talent and really inspiring and delighting people," Mayer said during a Monday interview with The Associated Press.

Like her predecessors, Mayer will have to come up with an effective strategy to compete against the juggernaut that Google has become and the increasingly influential force that Facebook Inc. is turning into as more people immerse themselves in its social network.

Both Google, the Internet's search leader, and Facebook have been beating Yahoo Inc. in the battle for Web surfers' attention and advertisers' marketing budgets. As Yahoo has lagged in that pivotal race, so has its financial performance and stock price. The stock has been slumping since Yahoo Inc. balked at a chance to sell itself to Microsoft Corp. for $47.5 billion, or $33 per share, in May 2008.

"If she can pull this off and turn around Yahoo, it will make her legacy," Gartner Inc. analyst Allen Weiner said of Mayer. "Yahoo's iconic yodel has been missing for a long time. Her mission will be to bring that yodel back."

This will be the first time that Mayer has run a company as she steps out of the long shadow cast by the Google's ruling triumvirate — co-founders Larry Page and Sergey Brin, along with Executive Chairman Eric Schmidt.

Although she had her responsibilities at Google narrowed two years ago, Mayer is still widely considered to among the Internet industry's brightest executives. A Wisconsin native, Mayer is a mathematics whiz with a sponge-like memory and a keen eye for design.

Mayer joined Google in 1999 as its 20th employee and went on to play an integral role in helping Page and Brin exploit their online search technology to outmaneuver Yahoo at a time when it was still the larger of the two companies. Now, it takes Google a little more than a month to generate as much revenue as Yahoo does in an entire year.

During Google's rise, Mayer helped oversee the development and design of the company's popular email, online mapping and news services. She also became a topic of Silicon Valley gossip during Google's early years while she dated Page for three years. They have since gotten married to other people.

"We will miss her talents," Page, now Google's CEO, said in a statement.

In another statement, Google Executive Chairman Eric Schmidt hailed Mayer as "a great product person, very innovative and a real perfectionist who always wants the best for users. Yahoo has made a great choice."

Mayer becomes one of the most prominent women executives in Silicon Valley, a place whose geeky culture has been dominated by men for decades. This is Yahoo's second female CEO, though. Silicon Valley veteran Carol Bartz, 63, spent more than two-and-half years as Yahoo's CEO before she was fired last September.

Within a few months, Mayer expects to be on a maternity leave. In another interview late Monday, Mayer revealed to Fortune magazine that she is pregnant with a boy. Her due date is Oct. 7. She said she had informed Yahoo's board about her pregnancy before the 11 directors unanimously voted to hire her.

Other prominent women executives in Silicon Valley include Hewlett-Packard Co. CEO Meg Whitman and another former top Google executive, Sheryl Sandberg, who defected to a rival when she joined Facebook as that company's chief operating officer in 2008. Other women CEOs running major technology companies include IBM Corp.'s Virginia "Ginni" Rometty and Xerox Corp.'s Ursula Burns.

Yahoo picked Mayer over an internal candidate, Ross Levinsohn, who had been widely considered to be the front-runner for the job after stepping in to fill a void created two months ago when the company dumped Scott Thompson as CEO amid a flap over misinformation on his official biography.

Thompson's bio inaccurately said he had college degree in computer science — an accomplishment that Mayer can rightfully list on her resume. She earned a master's in computer science at Stanford University, the same school where the co-founders from both Google and Yahoo honed their engineering skills.

This marks the second time that Yahoo has snubbed Levinsohn, 48, who previously had been best known for overseeing the Internet operations for Rupert Murdoch's News Corp.

Levinsohn had been vying for the CEO job after Bartz's firing, only to be passed over when Yahoo lured Thompson away from eBay Inc.

Mayer told the AP she wasn't looking to leave Google Inc. when Yahoo first contacted her June 18 about the job.

Her hiring threatens to alienate Levinsohn at a time when he has been steering Yahoo's recent emphasis on producing more original content and highlighting material provided by other media outlets such as ABC News and the financial news channel CNBC in an effort to persuade its website's 700 million monthly visitors to stick around longer.

"Marissa's first order of business should be convincing Levinsohn to stay," Gartner's Weiner said. "If he leaves, there will be an exodus" among the Yahoo employees working on the content for the company's website.

Mayer declined to comment on any discussions she might have planned with Levinsohn.

Even if Levinsohn and his allies leave, Yahoo should still benefit from the connections and reputation that Mayer built during her years at Google, predicted J.P. Morgan analyst Doug Anmuth.

Mayer may "be able to attract more high quality engineering talent to Yahoo, which we think is needed after several years of strategic and leadership flux," Anmuth wrote in a research note late Monday. Yahoo decided to lay off about 2,000 employees, or about 14 percent of its workforce, in April while Thompson was still CEO.

Anmuth also expects Mayer to bring in new managers as she shapes her team. Mayer will be greeted by at least one familiar face on Yahoo's senior management team. While serving as Yahoo's interim CEO, Levinsohn last month lured away another Google executive, Michael Barrett, to be Yahoo's chief revenue officer.

The terms of Mayer's contract weren't spelled out Monday. Mayer already struck it rich from the stock options that she got before Google went public in 2004.

Yahoo is set to report its second-quarter earnings Tuesday afternoon, just a few hours after Mayer starts her new job. Those numbers are expected to show Yahoo's revenue growth remains sluggish even though advertisers have been spending more money on the Internet.

Mayer said she intends to skip Yahoo's Tuesday afternoon conference call to discuss the results with stock market analysts so she can start to get a better grasp on the task ahead of her. She already has canceled vacation plans for next month.

"For me work is fun, and fun is work," Mayer said. "I am very excited about the big challenges here, and I can't wait to work on them. It's going to be very, very energizing."