The castle on the hill is where Portugal begins. Its high keep and ring of square towers date in their oldest parts to the 10th century, when the countess Mumadona Dias raised them to defend the Benedictine monastery she had founded below. Afonso Henriques, the first king of Portugal, was born in or near here in 1109, raised in the castle, and from it declared himself king after defeating his mother's forces at the Battle of São Mamede in 1128.
Entry is cheap and the interior is mostly empty stone, but the climb to the top of the keep gives you the whole town and the surrounding valley. Combine it with the Church of São Miguel and the Palace of the Dukes — the three sights sit within a few minutes' walk of each other on the upper hill.