Thousands of people turned out to see the Queen and Prince Philip visit Stafford as part of the 800th anniversary of its Royal Charter.
The Queen was escorted by the Mayoress Joyce Farnham
The couple attended a service at St Mary's Collegiate Church before a public walk about in the market square where 5,000 well-wishers gathered.
Later there was a tea party at the county showground with 200 guests born in the same year as the Queen.
King John signed the charter in 1206, creating the borough of Stafford.
The visit took place a day after a security alert in the town, in which four men were arrested under the Terrorism Act.
While at the church, the Queen performed the dedication of a new stained glass window designed by Abbots Bromley artist David Gleeson and depicting Stafford's shoe industry.
She also unveiled artwork by artist Adam Wilkinson of King John presenting the charter to the town.
Open new TV studio
The Queen was escorted by the Mayoress Joyce Farnham around the square.
Trevor Palmer, from Uttoxeter, had been waiting for several hours with his daughter Lucy, eight.
"She said she hoped we had a nice day," said Mr Palmer. "It has been worth the wait."
Representatives of the emergency services and the Air Cadet Force were also on parade in the square.
The Queen and the Duke of Edinburgh continued their visit to the town with lunch at Staffordshire County Council before heading to Staffordshire University to open its new film and television facilities.
The Royal Charter gave the townspeople certain rights, including the right of inheritance, and remains the cornerstone of the borough's legal existence.