Maine will become the fourth state to raise the smoking age to 21 and will adopt stricter regulations on the sale of electronic cigarettes after lawmakers on Wednesday voted overwhelmingly to override the governor’s veto.

Gov. Paul R. LePage, a Republican, had called the bill an attempt to “social engineer our lives,” saying that if 18-year-olds can join the military and fight in wars, they should be allowed to decide on their own whether to use tobacco.

Senator Paul Davis, a Republican who wrote the bill, said the governor’s remarks showed that he had missed the point of the legislation.

“People who join the military don’t have 15-year-old kids following them around and being impressed by their actions,” Mr. Davis told reporters after the Senate’s vote on Wednesday. “It’s about the availability of cigarettes in schools.”