McDonald's on Friday reported same-store sales growth that topped estimates, as promotions and store upgrades pay off for its U.S. business.

Shares of the company hit an all-time high of $218.15 in morning trading before giving up some of those gains. The company's stock, which has a market value of more than $165 billion, is up 20% so far this year.

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

Earnings per share: $2.05, adjusted, vs. $2.05 expected

Revenue: $5.34 billion vs. $5.33 billion expected

Global same-store sales growth: 6.5% vs. 5.1% expected

The company reported fiscal second-quarter net income of $1.52 billion, or $1.97 per share, up from $1.50 billion, or $1.90 per share a year earlier.

Excluding items, McDonald's earned $2.05 per share, in line with estimates by analysts surveyed by Refinitiv.

Net sales for the quarter were flat. The company reported revenue of $5.34 billion, topping expectations of $5.33 billion. Stripping out the impact of currency, revenue rose by 3%. McDonald's refranchising initiative once again hit sales this quarter. Selling corporate-owned stores to franchisees helps the company cut costs but hurts reported revenue because of accounting differences.

U.S. same-store sales grew by 5.7%, well above analysts' expectations of 4.5%. The company attributed the growth to successful deals like its 2 for $5 Mix and Match promotion and positive impact from its tech-focused store renovations. The restaurant chain also said its core menu items, which includes Big Macs and Quarter Pounders, continued to sell well in the U.S. And its Happy Meal business got a boost after renewing its relationship with Disney.

McDonald's plans to spend about $1 billion in fiscal 2019 to modernize its American stores with self-order kiosks and other upgrades in the hopes of imitating the success it has seen abroad with tech-focused renovations. The company is halfway to its goal of renovating 2,000 restaurants this year. In part because of the project, franchisees saw their average cash flow decline last year. But CEO Steve Easterbrook said that is turning around, with average franchisee cash flow growing eight consecutive months through June.

As part of its push into technology, McDonald's purchased machine learning company Dynamic Yield. Executives said that the company is already seeing an increase in average check at the 700 U.S. drive thrus with the technology, which recommends menu items based on time of day, weather and other factors. McDonald's added it to drive thrus in Australia this month and plans to have it in 8,000 drive thrus in U.S. in the next two weeks.

The company is also trying to drum up sales by expanding its delivery footprint. McDonald's said earlier this month that it's adding DoorDash as a delivery partner, ending its exclusivity with UberEats. Executives said on the conference call that they expect roughly 8,000 restaurants will have two delivery options.

This year, the company is predicting its delivery business will hit $4 billion. In Spain, delivery accounts for more than 10% of sales at stores that offer the service.

To speed up service times and improve customer satisfaction, McDonald's has been scaling down its menu. It discontinued its line of premium burgers, scaled back its late-night menu and told franchisees they can trim their all-day breakfast offerings. Easterbrook said that service times have dropped across many global markets. In June, for example, U.S. drive thru times dropped by 15 seconds.

The global fast-food chain also saw strong same-store sales growth outside of its home market. In its international stores owned by the company, sales at stores open at least 12 months increased by 6.6%, primarily driven by the performance of the U.K., France and Germany. In international markets operated by franchisees, same-store sales grew by 7.9%.

McDonald's said that it expects commodity costs for its five leading international markets — France, Germany, Australia, the U.K. and Canada — to become more expensive in fiscal 2019 than previously forecast. It raised its outlook for commodity cost increases to 2.5%, up from 2%.

Read McDonald's full press release here.