She was joined by her youngest son, Prince Edward, and his wife, Sophie, for a traditional ceremony opening the Royal Family's Holyrood week.
The 96-year-old has mobility issues and the decision to travel to Edinburgh was only confirmed on Monday morning.
She has cut back on engagements recently and was last seen in public during the Platinum Jubilee.
Following her arrival in Edinburgh, the Queen took part in the Ceremony of the Keys on the forecourt of the Palace of Holyroodhouse.
During the ceremony, which marks the beginning of Royal Week in Scotland, the monarch is symbolically offered the keys to the city by the Lord Provost.
But tradition dictates that she then returns them, entrusting their safekeeping to Edinburgh's elected officials.
The Queen is expected to be in residence at the palace - her official residence in the Scottish capital - until 1 July.
On Tuesday she will attend an armed forces ceremony in the gardens of Holyroodhouse.
All three services will be represented in the parade, which will mark the Platinum Jubilee in Scotland and pay tribute to her role as head of the UK armed forces.
However, the Queen will not take part in the annual garden party at Holyroodhouse on Wednesday.
Instead the Prince of Wales, the Princess Royal, Prince Edward and Sophie will host the party to recognise people who have made positive contributions to communities across Scotland.
Other events include a reception for gold Duke of Edinburgh award winners, hosted by Prince Edward at Holyroodhouse.
the monarch spent a night in hospital and for three months was under doctors' orders to only carry out light duties, missing a number of prominent events.
During the Platinum Jubilee celebrations, she pledged to continue to serve the country "to the best of my ability supported by my family".
Meanwhile, the Charity Commission is examining whether it needs to carry out a review of donations received by one of Prince Charles' charities.
The Sunday Times reported that millions of euros in cash were handed over by a former prime minister of Qatar.
The prince's representatives say "all correct processes were followed".
Prince Charles has also been named as a patron of the Royal College of Surgeons of Edinburgh, following in the footsteps of his father, the Duke of Edinburgh.