MEXICO CITY (AP) _ Fifteen tons of confiscated fireworks blew up inside a downtown Mexico City fire station, injuring at least 39 people and shattering windows for blocks, officials said.

''We were sitting here, joking and watching the men play volleyball, when everything suddenly went red and orange,'' said 1st Commander L. de Muro as workers swept up spent fireworks inside the station garage.

''Most of the men ran out of the cloud. Those who were near the fireworks couldn't. Two men were on fire,'' he said.

The blast, at about 5:55 p.m. Friday, shattered windows three blocks away, sent up a towering plume of white smoke and showered streets with broken glass.

Fire official Roberto Jaime Rangel said 15 tons of fireworks were stored outside at the fire station and that the explosion was caused by ''overheating.'' A Federal District criminal investigator said the cause was being investigated.

Fire Chief I. Ponce de Leon said the fireworks had been seized in various nearby markets and stored at the station for about six weeks.

He said the majority of the firefighters injured were working in the garage area when the explosion occurred.

Dr. Carlos Esperanza Garcia, doctor in charge at the nearby Hospital Ruben Lenero, said five people were taken there suffering from burns.

The Red Cross said eight firemen and one civilian, two of them in serious condition, were taken to hospitals by Red cross ambulances.

Saul Escobedo Ramirez, chief of ambulances at the police rescue service, said their ambulances picked up 30 injured, 23 of them firemen and seven civilians.

The state-run Notimex news agency quoted the attorney general's office as saying that 49 people were injured.

On Dec. 11, 1988, 62 people were killed in a Mexico City marketplace when tons of illegal fireworks exploded. That disaster was followed by a crackdown on fireworks vendors.

The fire station is three blocks from that market.