The Senate confirmed Linda McMahon to lead the Education Department by a party-line vote of 51 to 45.