President Trump made a surprise visit to Afghanistan on Thursday to serve Thanksgiving turkey to U.S. troops and meet with Afghan President Ashraf Ghani.

During the visit, his first to Afghanistan, Mr. Trump announced that he has restarted peace talks with the Taliban and would like to slash the number of American troops there from roughly 14,000 to 8,600. Mr. Trump said he wants a cease-fire to be part of the deal, after previous negotiations were scrapped due to a Taliban attack that killed a U.S. soldier from Puerto Rico.

“The Taliban wants to make a deal — we’ll see if they make a deal. If they do, they do, and if they don’t they don’t. That’s fine,” Mr. Trump said. “We’re going to stay until such time as we have a deal or we have total victory, and they want to make a deal very badly.”

He said there’s been momentum in the fight against Islamist extremists, despite the setback in talks in September.

“We’ve made tremendous progress over the last six months,” he said. “We’ve made tremendous progress and at the same time we’ve been drawing down our troops.”

The Afghan president thanked Mr. Trump for the American soldiers who’ve given their lives in the fight. He also noted that Afghan security forces are taking the lead from now on.

For security reasons, the trip from Mr. Trump’s resort in Florida was kept under wraps until he completed the journey to Bagram Air Field, the largest U.S. base in Afghanistan.

Mr. Trump smiled and exchanges pleasantries as he served turkey and sides to soldiers.

“You’ll come back,” he told one service member, apparently in praise of the food.

He snapped photos with troops and, in an address, spoke about America’s extensive investment in Afghanistan and defense more generally.

“I guess we’re spent two and half trillion since I’ve been in,” he said, adding that it’s a lot of money but needed for the U.S. to rebuild its military.

It was a festive atmosphere, with paper turkeys, paper pumpkins and paper leaves decorating the walls and the Macy’s Thanksgiving Day parade on the television.

Mr. Trump was greeted on the tarmac by Mark Milley, chairman of the Joint Chiefs of Staff, who arrived separately Wednesday.

The president came along with acting Chief of Staff Mick Mulvaney, National Security Adviser Robert O’Brien, Republican Sen. John Barrasso of Wyoming, Deputy White House Chief of Staff for Operations Dan Walsh, White House press secretary Stephanie Grisham, deputy press secretary Judd Deere and social media director Dan Scavino.

First lady Melania Trump did not go on the trip.

“It’s a dangerous area, and he wants to support the troops,” Ms. Grisham said of Mr. Trump. “He and Mrs. Trump recognize that there’s a lot of people far away from their families during the holidays and we thought it’d be a nice surprise.”

“It’s truly about Thanksgiving and supporting the troops,” she added, when asked about the political optics.

The trip was cloaked in secrecy, after a Christmas trip to Iraq in 2018 leaked before the reporting embargo lifted.

Mr. Trump secretly traveled from Florida to Andrews Air Force outside D.C. late Wednesday, while the Air Force One plane he’d traveled in previously remained parked at Palm Beach International Airport.

Traveling reporters who joined the trip had their phones and signal-emitting devices confiscated at Andrews and were not told of their destination until two hours before arrival.

Upon landing, Mr. Trump’s motorcade was followed to each location by teams of heavily armed combat troops in fatigues, helmets and night-vision goggles.