Coca-Cola (KO -0.01%) and PepsiCo (PEP -2.16%) both recently reported fairly lackluster first quarter earnings. Both companies faced the same headwinds -- tepid demand for soda and tough foreign exchange rates.

Nonetheless, both stocks have outperformed the S&P 500's 1% decline over the past 12 months by a wide margin -- Coca-Cola is up 9%, while PepsiCo has risen 8%. Let's take a closer look at why both soda makers are outperforming the market, and which stock is a better buy at current prices.

Image source: Pixabay.

Top line comparisons
Coca-Cola's revenue fell 4% annually last quarter to $10.3 billion, matching analyst expectations. Organic revenue, which excludes acquisitions and currency impacts, rose 2% on stronger sales of concentrate and a more diverse product mix of non-carbonated drinks like juices, teas, sports drinks, and bottled water.

Revenues fell year-over-year across all geographic regions except for North America, which posted 2% sales growth. Latin America and the Eurasia/Africa regions fared the worst due to currency issues, with respective declines of 12% and 14%. On the bright side, Coca-Cola now expects a full-year currency impact of "two to three" percentage points compared to its prior forecast for a four point hit. For the full year, it expects organic revenue to grow 4% to 5%.

PepsiCo's revenue declined 3% annually last quarter to $11.9 billion, which missed estimates by $20 million. Revenue from its Frito Lay North America, North American Beverage, and Asia/Middle East/North Africa units rose, but those gains were offset by declines across other geographic regions and Quaker Foods North America, which exited a dairy joint venture with Theo Muller late last year. Organic revenue rose 3.5%, with growth across all units except Quaker. PepsiCo still expects currency headwinds to reduce its revenue growth by four points this year, while organic revenue is expected to improve 4%.

Bottom line comparisons
Last quarter, Coca-Cola's GAAP net income fell 5% annually to $1.48 billion. On a non-GAAP basis, earnings fell 6% to $0.45 per share, topping estimates by a penny. Excluding the impact of its North American refranchising and the sale of its legacy energy brands to Monster, gross margins expanded due to lower production costs and a better product mix. For the full year, Coca-Cola expects constant currency earnings growth of 4% to 6%.

Coca-Cola's beverage brands. Image source: Coca-Cola.

PepsiCo's GAAP net income fell 24% annually to $931 million. On a non-GAAP basis, earnings rose 7% to $0.89 per share, which topped expectations by eight cents. Pepsico attributes that growth to "effective revenue management strategies" and "productivity initiatives" boosting gross margins.

Both companies rely on buybacks to support earnings. Coca-Cola only spent $150 million during the quarter on buybacks, but it plans to spend $2 billion to $2.5 billion on repurchases for the full year. PepsiCo spent $621 million on buybacks last quarter, and intends to spend $3 billion on repurchases this year.

Dividends and valuations
Coca-Cola and PepsiCo are both reliable dividend aristocrats. Coca-Cola has raised its dividend annually for 54 years, while PepsiCo has done the same for 43. Coca-Cola currently pays a forward annual yield of 3.1%, while PepsiCo pays 2.8%.

Coca-Cola currently trades at 27 times earnings, which is lower than PepsiCo's P/E of 28 but higher than the industry average of 25 for the soft drinks industry. Analysts currently expect Coca-Cola's earnings to rise 4% annually over the next five years, which gives it a 5-year PEG ratio of 5.7. PepsiCo's earnings are expected to improve 6.5% during that period, which gives it a lower 5-year PEG ratio of 3.3 -- indicating that it's cheaper than Coca-Cola relative to its earnings growth potential.

So should you buy Coca-Cola or PepsiCo?
Coca-Cola and PepsiCo's fundamentals are similar, but PepsiCo has two distinct advantages over Coca-Cola.

First, it's better diversified, with packaged foods from Frito Lay and Quaker, which together generated over a third of its revenue last quarter. Being able to pivot toward these businesses is useful if soda sales continue to decline. PepsiCo has also been trying to make its food products healthier, which might give it an edge against other packaged food companies.

Second, PepsiCo has a much lower PEG ratio, which suggests that it could have more upside potential than Coca-Cola.

Therefore, Coca-Cola and PepsiCo are both reliable stocks to hold for the long-term, but if you can only pick one, PepsiCo seems like a slightly better choice.