John Quincy Adams ( (listen); July 11, 1767 – February 23, 1848) was an American statesman, diplomat, lawyer, and diarist who served as the sixth president of the United States from 1825 to 1829. He previously served as the eighth United States Secretary of State from 1817 to 1825. During his long diplomatic and political career, Adams also served as an ambassador, and as a member of the United States Senate and United States House of Representatives representing Massachusetts. He was the eldest son of John Adams, who served as the second US president from 1797 to 1801, and First Lady Abigail Adams. Initially a Federalist like his father, he won election to the presidency as a member of the Democratic-Republican Party, and in the mid-1830s became affiliated with the Whig Party.