A cockpit safety device is credited with helping pilots avoid a mid-air collision at 25,000 feet over Indiana.

According to a preliminary investigation by the Federal Aviation Administration, the planes came within seconds of colliding because of an error by an air traffic controller.

FAA spokeswoman Elizabeth Isham Cory says the Tuesday evening incident happened amid a shift change during a busy time at the Chicago Center radar facility in Aurora.

Officials say that controller directed a Midwest Airlines plane flying east from Milwaukee into the path of a United Express jet heading west out of Greensboro, North Carolina.

The collision-avoidance device in the Midwest plane went off in the Fort Wayne area, and an airline spokeswoman says the pilots executed an emergency climb to get out of the way.