The Queen has paid tribute to the “heroism, courage and sacrifice” of those who died in the D-Day landings.
Mr Trump, who was on the last day of his UK state visit, said D-Day “may have been the greatest battle ever”.
Veterans of the landings in Normandy to liberate western Europe also attended.
Quoting a broadcast by her father, King George VI, at the time of the operation in World War Two, the Queen said the veterans of D-Day demonstrated “more than courage and endurance”, showing “unconquerable resolve”. “The fate of the world depended on their success,” she said. “Many of them would never return, and the heroism, courage and sacrifice of those who lost their lives will never be forgotten.”
She thanked them “with humility and pleasure, on behalf of the entire country, indeed the whole free world”. The countries represented at the event have agreed to make a joint statement pledging to ensure the “unimaginable horror” of the war is not repeated.
Called “the D-Day proclamation”, the 16 signatories – including the UK and the US – will commit to working together to “resolve international tensions peacefully”.
On Thursday, further memorial services are planned to mark the 75 years since the D-Day landings on 6 June 1944 – the start of the campaign to liberate Nazi-occupied north-west Europe.
The Queen told the crowd she was “delighted” to be able to thank veterans for their service.
She added: “When I attended the commemoration of the 60th anniversary of the D-Day landings, some thought it might be the last such event. “But the wartime generation, my generation, is resilient.”
Members of the armed forces and more than 300 veterans, who are all over 90 years old, attended the event in Portsmouth – one of the key embarkation points on D-Day.
Sgt John Jenkins, who is 99 and served with the Pioneer Corps in the Normandy landings, said: “I was terrified, I think everyone was.
“You never forget your comrades because we were all in it together. It is right that the courage and sacrifice of so many is being honoured 75 years on. We must never forget.”
Hundreds of other veterans are in northern France to mark the occasion there. Leaders from every country that fought alongside the UK on D-Day joined the Queen and the Prince of Wales for the commemorations on Southsea Common. They included French President Emmanuel Macron, US President Donald Trump and Canadian Prime Minister Justin Trudeau.
Also attending were German Chancellor Angela Merkel, as well as leaders from Australia, Belgium, Czech Republic, Denmark, Greece, Luxembourg, the Netherlands, Norway, New Zealand, Poland and Slovakia. The commemoration featured an hour-long production telling the story of the invasion, with testimony from veterans, theatrical performances and music. Veterans saluted the crowd, and actress Sheridan Smith performed a Dame Vera Lynn song.
Mr Trump read the same prayer given by President Roosevelt in a radio message ahead of the D-Day landings, while the last letter of a young resistance fighter, executed aged 16, was read out by President Macron.
Mrs May read a letter from Captain Norman Skinner of the Royal Army Service Corps, to his wife Gladys on June 3 1944. It was in his pocket as he landed on Sword Beach, but he was killed the following day. Thousands of members of the public, separated from the VIPs and veterans by a large security fence, watched the events live on big screens on Southsea Common.
A designated protest area was set up in Guildhall Square, more than a mile (1.6km) from the Southsea Common events. Civic leaders were worried any protests near the main event might upset the veterans. The event included a flypast of the RAF’s Red Arrows aerobatic team and historic aircraft, including Spitfires and Hurricanes.
The Queen, Prince Charles, the US president and first lady met six veterans at a reception after the ceremony. World leaders then met to discuss the western alliance and security.
Later in the afternoon, veterans Harry Read, 95, and John Hutton, 94, are due to honour their lost comrades by parachuting into Normandy. The commemorations to mark the Allied invasion of northern France come a day after Mr Trump had a series of political meetings as part of his three-day state visit to the UK.
Following the commemorations in Portsmouth, Mr Trump boarded Air Force One for a flight to Shannon for his first visit as US president to the Republic of Ireland.