SUNNYVALE, Calif. — Yahoo CEO Marissa Mayer announced her resignation Tuesday in a message to employees confirming that the firm’s $4.5 billion sale to Verizon has closed.

“It’s an emotional time for all of us,” Mayer wrote in a blog post. “Given the inherent changes to my role, I’ll be leaving the company. However, I want all of you to know that I’m brimming with nostalgia, gratitude and optimism.”

Mayer’s nearly five years leading the iconic Sunnyvale internet firm were notable for her failure to reverse its declining fortunes and for two world-record hacks of user data.

But in her message to workers, Mayer pointed to achievements by the firm that were largely overshadowed by the troubles.

Yahoo has attracted more than a billion monthly users, making it one of three internet firms in the world to boast that number of viewers, while increasing monthly mobile users to more than 650 million, Mayer said

She pointed to the business areas she has dubbed “mavens,” meaning mobile, video, native advertising and social, saying they generated more than $2 billion in revenue last year, 42 percent of the company’s total income, up tenfold from 2012.

Mayer also referred to other accomplishments under her watch, saying that since July 2012 “we oversaw the creation of $43 billion in market capitalization and shareholder value.”