The results topped Wall Street expectations, and the company raised its full-year guidance. Starbucks' shares were up almost 7 percent in aftermarket trading.
The Seattle-based chain, which has more than 19,000 locations around the world, said global sales rose 8 percent at cafes open at least 13 months, with all regions registering growth. In its flagship U.S. market, the figure rose 9 percent, driven by an uptick in customer visits.
The performance is in contrast to McDonald's Corp., which reported an underwhelming 1 percent increase in U.S. locations open at least a year earlier this week. The fast-food chain had partly blamed economic conditions, saying people have been reluctant to eat out.
Troy Alstead, chief financial officer for the chain, said the results demonstrate people's loyalty to the Starbucks brand, despite factors such as bad weather or a weak economy cited by other companies for underwhelming results in the quarter.
"We have some resilience, some insulation," Alstead said.
CEO Howard Schultz expressed the sentiment more emphatically in a call with analysts: "Starbucks today exists within a universe of one," he said, later noting the company was "extraordinarily proud and stunned" by its own results.
Starbucks has been making a number of changes in the U.S. to drive up sales. In April, it rolled out revamped sandwiches in new packaging that come with slightly higher prices; the new egg salad sandwich, for example, costs $5.25, up from $5.15 previously.
New salads and grain bowls were also introduced at about $7 per box. The idea is to entice people to spend more on food while they're in the store anyway. Right now, about one out of every three purchases includes food.
Offering better food also helps attract customers in the slower afternoon hours, rather than just in the morning when the cafes are busiest with people getting their morning caffeine fix.
Moving forward, the company noted that it's expanding its new baked goods to more stores; Starbucks has acknowledged that its sweet treats don't have a great reputation and is working to change that. The company also recently announced that it's teaming up with Danone to offer new, branded Greek yogurt parfaits that are set to start replacing its current offerings in cafes by next year.
Starbucks is also pushing aggressively to enroll people in its loyalty program, offering incentives such as a $5 load on cards for people who sign up. Alstead said people tend to visit more often and spend more once they enroll.
The company is also benefiting greatly from lower coffee costs, which are expected to continue for at least another year and half. Starbucks nevertheless instituted price hikes in the U.S. last month, a move that should help widen its operating margins even further.
For the quarter, Starbucks said sales rose 9 percent in China and the greater Asia region. It also managed to increase sales by 2 percent at established cafes in Europe, where it had been struggling. The company has been closing underperforming stores and licensing out operations in other regions to improve results.
Starbucks Corp. now expects earnings per share in the range of $2.22 to $2.23, up from $2.12 to $2.18. But moving forward, it cautioned that sales at established locations would ease back into the 5 percent to 7 percent range it saw in the first half of the year.
The company earned $417.8 million, or 55 cents per share, for the period ended June 30. That's up from $333.1 million, or 43 cents per share, a year ago.
Analysts on average expected 53 cents per share.
Revenue rose to $3.74 billion, more than the $3.72 billion Wall Street had forecast, according to FactSet
Its shares rose to $72.30, after closing up 2 percent at $68.17. Its stock is up 34 percent over the past year.