It is believed the victim, also 14, was stabbed in the back during the incident at Ayr Academy, South Ayrshire, shortly after 9am.
The injured pupil was last night in Yorkhill Hospital in Glasgow, where medical staff described his condition as "stable".
Police said that a 14-year-old boy had been arrested and was being detained in police custody.
The two pupils involved are both in the third year.
Police and an ambulance crew rushed to the school after receiving a 999 call.
Another schoolboy at the academy in the town's Fort Street said: "I think they were in the woodwork class (at the time of the incident].
"Teachers were running everywhere. The police arrived and then they were putting the handcuffs on a boy."
Linda Smith, 42, who works at the Tuck Shop opposite the school, said: "The wee boy was stabbed just after 9am and both the police and ambulance were here really quickly.
"I saw police officers bringing the knife out and it was a really big blade. I couldn't say exactly what size it was, but it was big. I saw a boy being led out in handcuffs.
"Paramedics brought the boy who had been stabbed out on a stretcher. He was lying on his stomach."
Ms Smith added: "It's terrible. You just never expect something as horrific as this to happen at the school across the road first thing on a Monday morning.
"My heart goes out to the parents of the poor boy who was stabbed.
"You just can't imagine what it must have been like for them to get a call like that from the school. I just hope the boy is going to be all right."
A spokeswoman for Strathclyde Police said yesterday : "Police were called to report of an incident which occurred at 9:15am during which a 14-year-old boy received serious injuries.
"He was taken to Ayr Hospital and transferred to Yorkhill Hospital in Glasgow. A 14-year-old boy has been arrested and detained in custody in relation to the incident. He is due to appear at Ayr Sheriff Court."
A spokeswoman for South Ayrshire Council said: "Following the incident at Ayr Academy, which is being investigated by Strathclyde Police, the council will ensure that all staff and pupils are given the necessary support and guidance to help them through this difficult time."
Ronnie Smith, the general- secretary of the EIS, Scotland's biggest teaching union, said such violence was unusual.
"The actual use of a weapon and stabbing of a pupil by a pupil is exceedingly rare. Weapons in schools are not generally a big issue. This is at the extreme end of the spectrum of behaviour.
"It should not be taken as something which goes in our schools.
"While we have problems with indiscipline, this tends to be low-level such as answering back rather than assaults."
Ayr Academy, which has around 700 pupils, is Scotland's oldest school and was established in 1233.