A commuter railroad train rammed into a tractor-trailer stuck at a crossing in this New York City suburb and derailed, slightly injuring 18 of the 40 people aboard, authorities said.

The truck's driver waved in a frantic attempt to warn the westbound Long Island Rail Road train's engineer but stood clear as the locomotive slammed into his truck Thursday evening, witnesses said."It just pushed the trailer right on its side," said Bob Morgan, who was working nearby.

LIRR spokesman Mike Charles, asked if the train's engineer had seen the driver waving, said the accident was being investigated.

The locomotive flipped on its side and into a lumberyard next to the tracks and five passenger coaches derailed, said Susan McGowan, a railroad spokeswoman. The only part of the train left on the tracks was a rear engine car.