The unnamed 15-year-old, who has been arrested, is alleged to have carried out the attack at Marshall County High School in Benton, western Kentucky.
The two students who died were also 15, according to Kentucky Governor Matt Bevin.
Another 12 other people were shot and five suffered other injuries during the shooting.
One of the victim died at the scene and the other after being taken to a hospital.
Kentucky State Police Commissioner Rick Sanders said five more people were in a “critical condition”.
The attack happened at the start of the school day.
Witnesses reported seeing students running away and the school was placed in lock down.
“The incident began at 7:57 am (13:57 GMT) when a 15-year-old student armed with a handgun entered the high school and started shooting,” Commissioner Sanders said.
Police were on the scene within 10 minutes and the suspect was arrested.
Dusty Kornbacher, who owns a shop next to the school said: “There were people everywhere, hugging and crying, and had their phones out, trying to get in touch with their children and loved ones.”
“It’s shocking because you never think it’s going to happen here. I’m sure that Sandy Hook and other places feel the same way, but yet we’re almost jaded because there’s so many.”
More from Texas Shooting
Texas church massacre: Identity of all 26 victims released
‘Gut-wrenching’ battle to save child victims of Texas church massacre
Sutherland Springs: Strength and grace in Texas town that was scene of massacre
US Air Force reveals it did not flag Texas gunman Devin Kelley’s criminal history
Pastor Frank Pomeroy speaks after daughter killed in Texas shooting
Texas church gunman Devin Kelley shot himself after high-speed car chase
It is the first fatal fatal school shooting in the US of 2018.
The arrested boy has been charged with two counts of murder and multiple counts of attempted murder.