The 15-year-old was taken into custody and charged with first-degree intentional homicide, the district attorney said. No one else was hurt.
The suspect was subdued before they arrived, according to Sauk County authorities, CBS affiliate WISC-TV in Madison, reports.
It was not clear why the student opened fire or if Weston Schools Principal John Klang was the intended target, Sheriff Randy Stammen said.
Witnesses said the student walked in with a shotgun before classes began. A custodian, teachers and students wrestled with him, but he broke through, took out a handgun and shot Klang three times, Stammen said.
The custodian said the teen was a special-education student who told him he was there to kill someone, but did not say who.
"He was calm, but he was on a mission," said Dave Thompson, 43, who also has two children at the school.
Sophomore Shelly Rupp, 16, described the boy as a freshman with few friends and said he was "just weird in the head."
"He always used to kid around about bringing things to school and hurting kids," she said at a gas station nearby where students and townspeople gathered.
Thompson said the student first pointed a shotgun in a teacher's face. Thompson grabbed away the gun, but the student then appeared to be reaching for another gun, so Thompson and the teacher took cover. Thompson then ran into a kitchen to call 911.
Junior Timmy Donovan said the student "pulled a .22 pistol out of his pants, and then started shooting the principal. And at that point, I guess the principal ran and tackled him to the ground."
Klang, 49, was shot in the head, chest and leg, authorities said. He died hours later at a hospital in Madison.
Sauk County authorities said they are not searching for any other suspects, WISC-TV reports.
The student, identified as Eric Hainstock, could get life in prison if convicted, District Attorney Patricia Barrett said. Wisconsin does not have the death penalty.
Children from pre-kindergarten to 12th grade attend the small school near Cazenovia, a community of about 300 people about 60 miles northwest of Madison.
The shooting took place two days after a gunman took six students hostage in a Colorado high school and killed one of them before committing suicide.
Laurie Rhea, 42, said the principal spent last weekend at the gas station washing cars for a homecoming fundraiser.
"All the kids just loved him," she said.
The shooting happened as the school was preparing for homecoming weekend. The homecoming parade, football game and dance were canceled or postponed.