Footage of the moment Jessica Stirling swerved across a wet road, narrowly avoiding an oncoming lorry, has been viewed online more than 300,000 times.
The footage, captured by a dash board camera of a vehicle she overtook, was played to Limavady Magistrates' Court.
Stirling, 18, avoided jail with a four-month term suspended for two years.
She had not long passed her driving test and was still a "restricted" driver when she made the overtaking manoeuvre on the road between Coleraine and Limavady.
The teenager, from Grasmere Court in Coleraine, pulled out to pass traffic in wet conditions during the morning rush-hour earlier this year.
Faced with an oncoming lorry, she swerved on to the hard shoulder on the opposite side of the road, rather than pull back into the left-hand lane.
Stirling continued driving on the hard shoulder over the brow of a hill, passing three more vehicles, before returning to the correct side of the road.
The court heard that Stirling had described the incident as "the biggest mistake in her life".
She previously pleaded guilty to dangerous driving.
At Wednesday's sentencing, a defence solicitor said her client's driving on the date in question had been "awful" but put it down to the teenager's "inexperience".
She said when Stirling overtook the vehicles and met an oncoming vehicle she "panicked" and moved onto the hard shoulder.
"It was only afterwards that she realised the dangers she put herself and her passengers in," the lawyer added.
After watching the footage, the judge told Stirling that it was "one of the worst bits of driving" he had ever seen.
He said the offence merited a custodial sentence, but he had to take into account her guilty plea and previous clear record.
"If I had decided this was a joyriding-type exercise where you had no disregard for anyone else on the road I would have imposed an immediate custodial sentence," he said.
"You made a mistake when overtaking.  You were very fortunate to escape without injuring yourself or anyone else," he added.
The judge also disqualified Stirling from driving for two years and said she would have to take an extended driving test to "ensure the public are safe" before she goes back on the road again.
A woman who drove the wrong way along a hard shoulder after swerving across oncoming traffic has heard it was among the "worst" driving a judge had seen.