By Heather Haddon

McDonald's Corp. said same-store sales in the U.S. fell 5% annually in May, a big improvement on the double-digit loss posted a month earlier at the height of domestic lockdowns to combat the new coronavirus.

The burger giant said Tuesday that its drive-throughs and takeaway service had helped it regain much of the ground lost in April, when same-store sales fell 19%. The improvement came despite only about 1,000 of McDonald's 14,000 U.S. restaurants having restored dine-in service with reduced seating. Nearly 95% of the chain's U.S. locations have drive-throughs, the company said.

"I am confident in our ability to manage through the immediate challenges and emerge from this pandemic in a position of competitive strength," Chief Executive Chris Kempczinski said.

Restaurant chains with drive-throughs are weathering the pandemic better than casual-dining chains and independent restaurants without those means of sales. Surveys show that consumers generally feel that ordering from a drive-through is one of the safest ways to patronize restaurants while the virus continues to spread.

Carrols Restaurant Group Inc., the largest U.S. Burger King franchisee, said Monday that sales at its burger restaurants in the week ended June 7 were up nearly 3% from a year earlier on the back of drive-through business. Its sales fell 34% in the week ended March 29, after the pandemic hit.

Still, fast-food chains are struggling with overall declines in the number of customers visiting their stores, particularly in the mornings. Breakfast orders fell 18% at major restaurant chains in the week ended June 7 compared with last year, the worst decline of any part of the day, according to market researcher NPD Group Inc.

McDonald's said that breakfast sales and morning guest counts remained negative and that more than half the decline in same-store U.S. sales was due to breakfast losses. Starbucks Corp. said last week that its key morning business remains depressed because of the ways the virus has undone normal commuter and meal patterns, particularly in urban markets.

"It is that morning peak in those particular markets that will be more challenging to recover for Starbucks," Chief Financial Officer Pat Grismer said.

McDonald's and other U.S. chains with global footprints also continue to suffer in international markets that have mandated store closures. Same-store sales in McDonald's internationally operated markets were down 41% in May, when closures in countries including the U.K. and France weighed on sales.

Yum Brands Inc. said last week that its global same-store sales declined 19% in the quarter-to-date through May, mostly because of double-digit declines internationally at its KFC, Pizza Hut and Taco Bell locations because of closures. Sales in the U.S. at those chains, by comparison, were positive during the period.

Mr. Kempczinski said McDonald's is preparing for the virus to impact consumer habits for some time. McDonald's executives are also deciding which changes made during the pandemic to keep, including a more-limited menu that has improved restaurant efficiency. Average drive-through wait times have fallen by 25 seconds in the U.S., in part, because the menu has been stripped of all-day breakfast and some slower-selling items, executives said.

Mr. Kempczinski said some, but not all, of those items would come back eventually.

"Ultimately, the customer is looking for a broader variety of menu items than what we currently have," he said.

McDonald's is also considering when to introduce new products it had in the works, such as a new chicken sandwich. KFC last month began testing a new chicken sandwich, and Popeyes Louisiana Kitchen's sales have remained up by double-digits during the pandemic due in part to the popular sandwich it introduced last year.

Write to Heather Haddon at heather.haddon@wsj.com