Foyle College relocated to its new £23.5 million home in 2018.
The Princess Royal was given a tour of the school before unveiling a plaque to mark the official opening.
Foyle College can trace its origins all the way back to 1617 when a Free Grammar School was established in the city.
Principal Patrick Allen said the new campus meant teachers and students have the “modern facilities to match their enthusiasm and passion for learning and teaching”.
“With the benefit of the facilities that are now available, I am confident that the school will go from strength to strength in the coming years,” he said.
During the visit music students demonstrated the school’s recording studio for the royal visitor.
The Princess Royal also met students working to excavate a World War Two Spitfire and P38 Lightning in County Monaghan in the Republic of Ireland.
She spoke with some of the schools’ rising sports talent and its Duke of Edinburgh Award Scheme leaders.Foyle College was founded by the merchant Taylor Mathias Springham in the early seventeenth century.
The move to Derry’s Waterside last year marked the first time the school has not been located on the west bank of the city.