At the Restoration the sequestration of his father's lands was annulled, and in 1665 he succeeded by the death of his elder brother as the 3rd Baronet Gordon, of Haddo and to the family estates. He returned home in 1667, was admitted advocate in 1668 and gained a high legal reputation. He represented Aberdeenshire in the Parliament of Scotland of 1669 to 1674, the Convention of Estates of 1678 and the following parliamentary assembly of 1681/82. During his first session he strongly opposed the projected union of England and Scotland. In November 1678 he was made a Privy Counsellor for Scotland, and in 1680 was raised to the bench as Lord Haddo. He was a leading member of the Duke of York's administration, was created a Lord of the Articles in June and in November 1681 Lord President of the Privy Council. The same year he is reported as moving in the council for the torture of witnesses. In 1682 he was made Lord Chancellor of Scotland, and was created, on 13 November, Earl of Aberdeen, Viscount Formartine, and Lord Haddo, Methlick, Tarves and Kellie, in the Scottish peerage, being appointed also Sheriff of Aberdeen and Sheriff of Edinburgh later the same year. Burnet reflected unfavourably upon him, writing of him, "...a proud and covetous man... the new chancellor exceeded all that had gone before him. He executed the laws enforcing religious conformity with severity, and filled the parish churches, but resisted the excessive measures of tyranny prescribed by the English government; and in consequence of an intrigue of the Duke of Queensberry and Lord Perth, who gained the duchess of Portsmouth with a present of £27,000, he was dismissed in 1684. After his fall he was subjected to various petty prosecutions by his victorious rivals with the view of discovering some act of maladministration on which to found a charge against him, but the investigations only served to strengthen his credit. He took an active part in parliament in 1685 and 1686, but remained a non-juror during the whole of William's reign, being frequently fined for his non-attendance, and took the oaths for the first time after Anne's accession, on 11 May 1703. In the great affair of the Union in 1707, while protesting against the completion of the treaty till the act declaring the Scots aliens should be repealed, he refused to support the opposition to the measure itself and refrained from attending parliament when the treaty was settled. He is described by John Mackay as, "...very knowing in the laws and constitution of his country and is believed to be the solidest statesman in Scotland, a fine orator, speaks slow but sure. His person was said to be deformed, and his want of mine or deportment was alleged as a disqualification for the office of Lord Chancellor.