Two students, Andre Wilkins, 15, and Andrel Napper, 17, were injured in Tuesday's shooting at Martin Luther King Jr. High School, a public school which has 3,000 students.
Police said Rodriguez, who turned 18 Friday, shot the two because they had teased his girlfriend and pulled a bandanna off her head.
Police continued to investigate how a gun was brought into the school, which has metal detectors and safety officers. According to the United Federation of Teachers, the shooting was the first inside a New York City public school since Sept., 1994.
The shooting occurred on what would have been the 73rd birthday of the school's namesake.
"We were in school and we heard two gunshots," senior Romain Morrison, 17, said on Tuesday. "They were telling everyone to get out of the hallways."
The victims were shot from behind in a fourth-floor hallway. One was shot in the back and the other in the buttocks. Both were hospitalized in serious condition.
A .380-caliber handgun was found on the fifth floor, along with three shell casings, authorities said.
The school was swiftly locked down and students kept in their classrooms as police in riot gear swept the building on Amsterdam Avenue between 65th and 66th streets.
"They wanted us to be in the room, locked up until they had things under control," said senior Giorlys Alvarez, 17, who was locked in a classroom for more than an hour.
The school's metal detectors and X-ray machines were working Tuesday, Police Commissioner Ray Kelly said.
Teacher Octavia Melian said the school had previous problems with students breaching security. She said students would pass through the metal detectors, then open side doors for their friends to smuggle guns and other items inside.
"It's been a constant concern with the faculty and the student body," she said.
©MMII, CBS Worldwide Inc. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report