Motorola's roller-coaster ride is back on the upswing.

The phone maker, now owned by Lenovo, cracked the top five in the U.S. during the third quarter for the first time in nearly two years.

Motorola nearly doubled shipments to 2.1 million smartphones during the third quarter, up from 1.1 million a year earlier, according to researcher Strategy Analytics.

The company nearly doubled its market share to 5.2 percent, up from 2.7 percent a year earlier. Apple is the top seller of phones in the U.S., with 30 percent of the market, Strategy Analytics says. ZTE, in fourth place ahead of Motorola, has 12 percent share.

It's the first time Motorola has been in the top five since the fourth quarter of 2015.

Motorola had strong sales of both its budget-conscious G line and high-end phones such as the Moto Z Play.

"Motorola's recovery has been driven by expanded distribution with all top four U.S. carriers," Ken Hyers, a director at Strategy Analytics, said in a statement.