The suspect was identified as Dylan Butler, a student at Perry High School, officials said at a news briefing. He was found dead with an apparent self-inflicted gunshot wound by responding officers.
Police also discovered an improvised explosive device when searching the high school, Mitch Mortvedt, an assistant director with the state Department of Criminal Investigation, told reporters. Members of the state fire marshal's office and the federal Bureau of Alcohol, Tobacco, Firearms and Explosives rendered the device safe.
The Iowa shooting, on the district's first day of classes in 2024, is part of a national epidemic of gun violence in U.S. schools that has worsened in recent years.
There were 346 incidents in which a gun was brandished or fired at school or a bullet hit school property in 2023, according to the K-12 School Shooting Database. That was the highest of any year in the website's data, which goes back to 1966, and represented the third record-setting year in a row.
Four such incidents have already taken place in 2024, just four days into the year, according to the site.
Perry, a town of about 7,900, is about 40 miles (64 km) northwest of Des Moines, the state's capital city. The middle and high schools share a single campus.
The attack took place just after 7:30 a.m. (1330 GMT), before most students and faculty had entered the building. Butler was armed with a pump-action shotgun and a handgun, Mortvedt said.
Butler made several social media posts around the time of the shooting, Mortvedt said without offering specific details. The shooter's motive was under investigation, he said.
Four of the wounded victims are students, and the fifth is a school administrator, said Mortvedt, who declined to release any names. Another school district, Easton Valley, issued a statement saying it had received word that Dan Marburger, the high school principal, was the administrator shot in the attack.
One victim was in critical condition but did not appear to be facing life-threatening injuries, Mortvedt said, while the other four were in stable condition.
"This senseless tragedy has shaken our entire state to the core, and I want this community to know that every Iowan stands with you" Iowa Governor Kim Reynolds said at the new briefing.
FBI agents from the Omaha-Des Moines office were assisting in the investigation, and U.S. Attorney General Merrick Garland was briefed on the shooting, a Justice Department spokesperson said.
"We cannot allow these tragedies to continue," White House Press Secretary Karine Jean-Pierre said. "We have to do something."
Republican presidential candidate Vivek Ramaswamy had been scheduled to hold a rally in Perry but changed the event to an in-person prayer meeting after reports of the shooting, a campaign spokesperson said.
Iowa will hold the first statewide contest for the 2024 Republican presidential nomination in 11 days.
"Pray for the community in Perry, Iowa this morning." Ramaswamy said on the X social media platform.