As a U.S. Senator from Massachusetts (1827–41), he became a leading political figure of the United States. The dominant interest of his constituency had changed from shipping to industry, so Webster now abandoned his earlier free-trade views and supported the tariff of 1828. In the states' rights controversy that followed he took a strong pro-Union stand, defending the supremacy of the Union in the famous debate with Robert Y. Hayne in 1830. Although Webster supported President Jackson in the nullification crisis, he vehemently opposed him on most issues, especially those concerning financial policy.
Webster became a leader of the Whig party and in 1836 was put forward as a presidential candidate by the Whig groups in New England. However, he won only the electoral votes of Massachusetts. His prominence brought him into consideration in later presidential elections, but he never attained his ambition. After William Henry Harrison was elected (1840) President on the Whig ticket, Webster was appointed (1841) U.S. Secretary of State. Although every other cabinet officer resigned (1841) after John Tyler had succeeded to the presidency and had broken with the Whig leaders, Webster remained at his post until he had completed the settlement of the Webster-Ashburton Treaty (1843).
Again (1845–50) in the Senate, Webster opposed the annexation of Texas and war with Mexico and faced the rising tide of sectionalism with his customary stand: slavery was an evil, but disunion was a greater one. He steadily lost his following and was sorely disappointed when the Whig party nominated Zachary Taylor for President in 1848. Cherishing the preservation of the Union above his own popularity, Webster, in one of his most eloquent and reasoned speeches, backed the Compromise of 1850 and was reviled by antislavery groups in the North and by members of his own party. He served again (1850–52) as Secretary of State under President Millard Fillmore.