Archaeologists made the discovery during work to build new Tattoo stands
Late medieval walls and the foundations of what appears to be a military spur, which formed part of the outer defences at Edinburgh Castle, have been found.
The defences, which date from at least the 16th Century, were discovered by archaeologists during foundation works for new Military Tattoo stands.
Service trenches were opened which revealed two structures about 2m beneath the esplanade.
Archaeologists will record the remains before they are reburied.
The first trench, which was discovered earlier this week by experts from CFA Archaeology, revealed the remains of a wall about 2ft wide, which is thought to be part of the north perimeter boundary wall between the city and the castle.
The opening of a second trench uncovered what initially looked like a continuation of the boundary wall, but now appears to be separate remains, similar to the foundations of a spur, a 16th Century defensive bastion which protected the entrance to the castle.
Both appear in a 17th Century drawing by Gordon of Rothiemay, but until now the precise location had remained unknown.
Culture Minister Fiona Hyslop said: "Edinburgh Castle has a long and important role at the centre of the country's history.
"Finds of this kind are extremely valuable in terms of improving our understanding of the development of the castle, and its defensive needs during key periods in time, as well as showcasing effective modern day partnership working between the heritage and construction sectors."
Peter Yeoman, Historic Scotland's head archaeologist, said: "As the remains have effectively lain covered for over 250 years, this is a unique opportunity to learn more about the esplanade during this period in the castle's history.
"Until recently we have only had early drawings to go by, but we are now able to examine the archaeology and record and preserve as much of it as is possible for future generations.
"The remains are too deep down to be displayed, but to have this knowledge is a great step forward."
The esplanade was formed in 1753 to create a parade ground for the military. Large amounts of levelling was deposited on the area in front of the castle, covering up earlier buildings.