Starbucks President and Chief Executive Officer Kevin Johnson is pictured at the Annual Meeting of Shareholders in Seattle, Washington on March 20, 2019.

Starbucks on Thursday reported earnings that outpaced analyst expectations and raised its outlook for the year, as customers spent more at its cafes in the U.S. and sales growth in China was stronger than expected.

Shares of the company were unchanged in extended trading.

"We are especially pleased with our comparable store sales growth in our two lead markets, the U.S. and China, where we are also continuing to drive strong new store development with industry-leading returns," CEO Kevin Johnson said in a statement.

Here's what the company reported compared with what Wall Street was expecting, based on a survey of analysts by Refinitiv:

Earnings per share: 60 cents, adjusted, vs. 56 cents expected

Revenue: $6.31 billion vs. $6.32 billion expected

Same-store sales: 3% vs. 2.9% expected

The coffee chain reported fiscal second-quarter net income of $663.2 million, or 53 cents per share, up from $660.1 million, or 47 cents per share, a year earlier.

Excluding the sale of its Tazo brand, costs related to its licensing deal with Nestle and other items, Starbucks earned 60 cents per share, topping the 56 cents per share expected by analysts surveyed by Refinitiv.

The company raised its full-year earnings forecast. It is now expects adjusted, or non-GAAP, earnings per share in the range of $2.75 to $2.79, up from a prior range of $2.68 to $2.73. Analysts were forecasting 2019 earnings of $2.71 per share.

Net sales rose 5% to $6.31 billion, missing expectations of $6.32 billion.

The company reported same-store sales growth of 3%, beating Wall Street's estimates of 2.9%. Starbucks attributed the growth to a 3% increase in average ticket.

"While much of the beverage comp sales growth was driven by ticket, close to half of the ticket growth was from beverage mix and match, demonstrating that our higher margin premium offerings resonated with customers and customers bought more beverages per transaction," CFO Pat Grismer told analysts on the conference call.

Starbucks released one of those pricier drinks last month, the Cloud Macchiato, with help from pop star Ariana Grande. Johnson called the drink's launch "the second most viral Starbucks campaign ever." The beverage is part of its wider drink innovation strategy: focus more on cold drinks and less on limited-time offerings and Frappucinos. The strategy is meant to build more brand affinity to keep customers coming back to Starbucks' coffee shops regularly.

The chain also saw the best afternoon performance in three years, due to the popularity of its cold drinks and improved in-store experience. In the U.S., sales at stores open at least a year grew by 4%.

The company even saw same-store sales growth of 3% in China, where the company is facing increased competition from Luckin Coffee and a slowing economy.

"This performance is especially noteworthy when you consider the intensity of competition from discounting in China, as well as our aggressive pace of new store development," Johnson said.

However, transactions at stores open at least a year fell 1% in the country, meaning that traffic was declining.

In just four months, Starbucks added delivery to 2,100 of its stores in China through its partnership with Alibaba. Johnson said that the average delivery time is under 20 minutes. The company is planning to launch mobile order and pay in the country by the end of fiscal 2019.

In the second quarter, Starbucks Rewards reached 8.3 million active Chinese members. Executives said on the conference call that loyalty program members represent over 50% of its transactions in China.

Starbucks' loyalty program grew to 16.8 million active members in the U.S., up 13% from last year. The Seattle-based company recently revamped the program, offering a wider range of redemption options for members. The changes also mean that customers have to spend more to earn a free drink.

Unlike the last time that it made major changes to its loyalty program back in 2016, Starbucks has largely avoided social media backlash. COO Roz Brewer said that the company has also not seen as many phone calls to its customer service hotline as expected.

During its second quarter, the company added 319 net new stores, bringing its total to 30,184 worldwide. A whopping 94% of its openings were outside of the U.S., including a Reserve Roastery in Japan.

And Starbucks has no plans to slow down store openings in the second half of 2019. The company plans to add 2,100 net new stores globally. Nearly 600 of those openings will be in China, as rival Luckin plans to open 2,500 this year in an attempt to overtake Starbucks as the largest coffee chain in the country. Rather than mimicking Starbucks' homey store concept, the fast-growing newcomer's strategy has focused on stores designed for convenience and easy pick-up.