After World War II, Kennedy entered politics (partly to fill the void of his popular brother, Joseph P. Kennedy, Jr., on whom his family had pinned many of their hopes upon but who was killed in the war). In 1946, Representative James M. Curley vacated his seat in an overwhelmingly Democratic district to become mayor of Boston and Kennedy ran for that seat, beating his Republican opponent by a large margin. He was reelected two times, but had a mixed voting record, often diverging from President Harry S. Truman and the rest of the Democratic Party.
A young Senator Kennedy in 1953.In 1952, Kennedy ran for the Senate with the slogan "Kennedy will do more for Massachusetts." In an upset victory, he defeated Republican incumbent Henry Cabot Lodge, Jr. by a margin of about 70,000 votes. Kennedy opposed fellow Senator Joseph McCarthy's aggressive campaign to root out supposed Communists and Soviet spies in the U.S. government. McCarthy had been a friend of Kennedy's father, and Kennedy's younger brother Robert F. Kennedy briefly worked for McCarthy. Although Kennedy was ill during the 65–22 vote to censure McCarthy, he had helped coordinate it.
Kennedy married Jacqueline Bouvier on September 12, 1953. He underwent several spinal operations in the two following years, nearly dying (receiving the Catholic religion's Last Rites three times during his life), and was often absent from the Senate. During this period, he published Profiles in Courage, highlighting eight instances in which U.S. Senators risked their careers by standing by their personal beliefs. The book was awarded the 1957 Pulitzer Prize for Biography.
In 1956, Kennedy campaigned for the Vice Presidential nomination at the Democratic National Convention, but convention delegates selected Tennessee senator Estes Kefauver instead. However, Kennedy's efforts helped bolster the young Senator's reputation within the party.