PepsiCo CEO Indra Nooyi, one of the most prominent women to lead a Fortune 500 company, will step down on October 3.

She will remain as chairwoman of the board of directors until early 2019. Nooyi, 62, will be replaced by Pepsi's (PEP) global operations chief Ramon Laguarta, 54.

Nooyi, who was born in India, is one of a handful of people of color to lead a Fortune 500 company.

She helped turn Pepsi into one of the most successful food and beverage companies in the world. Sales grew 80% during her 12-year tenure. She spearheaded Pepsi's transition to a greener, more environmentally aware company.

Nooyi has been with Pepsi for 24 years. Before becoming CEO, she led the company's expansion through acquisitions, including its 2001 purchase of Quaker Oats. She earned $31 million last year, and $87 million over the last three years, according to company filings.

"Growing up in India, I never imagined I'd have the opportunity to lead such an extraordinary company," she said.

Nooyi grew up in a middle class family in India. When she and her sister were young, their mother challenged them at the dinner table each night to give speeches about what they would do if they were prime minister or another world leader, a Pepsi spokesperson said. After the speeches, their mother would vote.

Her departure leaves only 24 women leading Fortune 500 companies, after Beth Ford became the CEO of Land O'Lakes just last week. Just more than a year ago, there were 32 women leading Fortune 500 companies.

Since the middle of last year, several high-profile female CEOs have announced they were stepping down, including Marissa Mayer at Yahoo, Irene Rosenfeld at Mondelez (MDLZ) and Meg Whitman of Hewlett Packard Enterprise (HPE).

Related: Why it matters so much every time a woman CEO leaves

Laguarta, Nooyi's successor, has served as president of PepsiCo since September 2017, overseeing global operations, corporate strategy, public policy and government affairs. Laguarta is also an immigrant, having been born in Spain. He had previously been CEO of the European and sub-Saharan African unit of Pepsi before being named the company's president.

Nooyi's 12 years as CEO is fairly long by standards of the job. A study by Equilar found that the average tenure for a CEO at large companies is only five years.

Nooyi praised her successor, calling him "exactly the right person to build on our success." She also received praise from analysts following her announcement.

"We have had the privilege of knowing Nooyi for over a decade and have been very impressed with her leadership acumen and very thoughtful approach to managing PepsiCo through what has been a period of very choppy waters for broader consumer packaged goods," said Bonnie Herzog, senior analyst at Wells Fargo. "Nooyi has been an exemplary CEO and sets the bar high."

Still, Pepsi's stock lagged the broader market in recent years, and it has trailed rival Coca-Cola (KO). Shares are down 1.8% this year, compared with a nearly 7% rise in the S&P 500 index. Both Coke and the S&P also have slightly outperformed Pepsi during Nooyi's tenure. Shares of Pepsi were slightly higher in early trading.

Related: Why Coke is winning the cola war

Americans' growing distaste for sugary sodas has hurt both Coke and Pepsi. In 2014 activist investor Nelson Peltz pushed for Pepsi to spin off its snack business as a separate company. But Nooyi fought calls to break up the company. It turned out to be the right call, according to Neil Saunders, a managing director of GlobalData.

"Nooyi will leave a company stronger than the one she inherited 12 years ago," Saunders said. "It was her insistence on building up and maintaining a strong snack business that was most prescient. With demand for soda under pressure, PepsiCo can now take comfort in the fact that it has a balanced portfolio of products."

Related: Gatorade is going sugarless for the first time

Nooyi has stressed the importance of shifting Pepsi toward healthier food and snacks, saying it was important for the company's future because of consumers' increasing attention to health.

She broke the company's offerings into three categories: Fun For You includes traditional, higher-calorie soft drinks and snacks. Better For You includes diet drinks and lower-calorie snacks, such as potato chips that are baked instead of deep-fried. And Good For You includes foods such as Quaker Oats oatmeal, Sabra hummus and Naked Juice smoothies.

In 2010, Pepsi set a goal of tripling sales of its healthiest offerings to $30 billion by 2020. By 2017, sales had grown only 75%, to $17.5 billion.

In 2016, Pepsi revised the goal. It now wants sales growth of healthier products to outpace traditional drinks and snacks by 2025.

-- CNNMoney's Paul R. La Monica and Julia Carpenter contributed to this report.