In the 10th century, after the widowhood of Count Hermenegildo (or Mendo) Gonçalves, Countess Mumadona Dias took over the government of the county of Portucalense and took two very important measures: she founded, in the lower part of Guimarães, the Monastery of Santa Maria (around 950) and, in the upper part, a castle, the so-called Castelo de S. Mamede (between 950 and 957).

The construction of this castle was necessary to defend the newly built Monastery and the populations that, in the meantime, had settled next to these two buildings. The construction of this Castle was also a way of asserting its power over the other feudal lords. A diploma marking the delivery of the Castle of S. Mamede to the Monastery of Guimarães, on December 4, 968, is the first known reference to this fortification.

As historian Mário Jorge Barroca says, the castle of this period would be very different from the one we know today, since they were incipient works, the towers were scarce and the keep towers were unknown, often requiring large amounts of earth to be moved to create steep slopes. .

The Castle has undergone numerous changes, its current configuration having little to do with its original form. In fact, under Count D. Henrique some reforms were carried out and, according to Mário Barroca, there are vestiges that are supposed to date from the time of this Count. Later, in the 13th/14th centuries, under D. Dinis the Keep Tower was built and the eight towers that flank the castle wall were erected. Other later reforms were carried out during the reign of D. João I, defining its final form here.

It is also interesting that Guimarães Castle is the first Portuguese castle to have photographic records showing us the structure as it was in the 19th century. These photographs were taken by Frederick William Flower, an English merchant who lived in Porto for a few years and who was a pioneer in the use of photographic techniques.

After centuries of abandonment and ruin, the Castle was subject to an imperative restoration, carried out in the 1930s by the now defunct DGEMN – Direção-Geral dos Edifícios e Monumentos Nacionais. The aim of these improvement works was to rehabilitate the most emblematic place among the national castles.

Guimarães Castle has been a National Monument since 1910.