Coca-Cola Co reported better-than-expected profit and revenue for the third quarter as North America sales rose 3 percent on higher demand for Sprite, tea and coffee.

The company said it was gaining marketshare against rivals, echoing sector analysts’ views ahead of the results that it was eating into the sales of arch rival PepsiCo Inc.

While the Coca-Cola’s overall volume sales in North America remained flat in the third quarter, Sprite sales rose in the mid-single digits and tea and coffee sales increased in the low-single digits. Diet Coke sales were down.

PepsiCo this month reported a drop in quarterly beverage sales in North America for the first time in two years, hit by weak demand for Gatorade and marketing missteps.

Coca-Cola is gaining share from rival Pepsi due to better performance in the territories it has franchised to bottlers and a more aggressive push in the non-carbonated drink business, RBC Capital Markets analyst Nik Modi wrote in a pre-earnings note.

Coca-Cola has also been cutting costs, including by the refranchising of its low-margin bottling operations and reducing workforce. Cost of goods sold fell 18 percent in the quarter, and general and selling expenses dropped 20 percent.

Net income attributable to Coca-Cola’s shareholders rose to $1.45 billion, or 33 cents per share, in the third quarter ended Sept. 29, from $1.05 billion, or 24 cents per share, a year earlier. [nBwgSl57a]

Excluding items, the company earned a profit of 50 cents per share, beating the average analyst estimate of 49 cents, according to Thomson Reuters I/B/E/S.

Revenue fell 14.6 percent to $9.08 billion as the company refranchised some bottling operations, but beat the average estimate of $8.72 billion.

Reuters (Reporting by Sruthi Ramakrishnan in Bengaluru; Editing by Saumyadeb Chakrabarty)