PALM BEACH GARDENS, Fla. -- Tiger Woods pleaded guilty Friday to reckless driving in a deal that will keep him out of jail as long as he stays out of trouble, resolving charges from an arrest last spring in which he was found passed out in his Mercedes on May 29 with prescription drugs and marijuana in his system.

Woods spoke only briefly during a hearing at a Palm Beach County courthouse, answering questions from a judge about his plea agreement. Prosecutors dropped a driving under the influence charge for the superstar golfer, and the judge warned him to behave.

"This particular plea agreement has no jail time on it. However, if you violate your probation in any significant way, I could revoke your probation and then I could sentence you to jail for 90 days with a fine of up to $500. Is that understood?" Judge Sandra Bosso-Pardo said.

Woods, 41, nodded. He did not make any statement during the hearing or outside the courthouse.

The DUI arrest was the first time Tiger Woods had been in trouble since Thanksgiving weekend 2009. Curtis Compton/Zuma Press/Icon Sportswire

Woods will enter a diversion program and spend a year on probation and pay a $250 fine and court costs. He has already met some of the program's other requirements, completing 50 hours of community service at the Tiger Woods Foundation, Palm Beach County State Attorney Dave Aronberg said.

Aronberg didn't say specifically what Woods did with the charitable group, but said he met the terms of the deal. Woods also attended a workshop in which victims of impaired drivers detail how their lives were damaged.

Aronberg said most DUI offenders do not qualify for the diversion program because they have a prior record or were in an accident. About 2,500 first-time offenders have graduated from the county program since it began four years ago.

"This is designed for first-time offenders, where the person made a one-time mistake and they're going to overcome it," Aronberg said. "Mr. Woods was treated like any other defendant in his situation."

Since he was intoxicated with prescription drugs and marijuana, according to court records, he will also be required to undergo regular drug tests. Woods is also not allowed to drink alcohol.

Woods arrived at the courthouse in a black sport utility vehicle, wearing sunglasses and a dark suit with no tie. Police officers surrounded him as he walked down a hallway inside the courthouse and they ringed the inside of the courtroom during the high-profile proceeding.

Woods was arrested about 2 a.m. May 29 when officers found him unconscious in his Mercedes, which was parked awkwardly on the roadside and had damage to the driver's side.

It's not clear how he damaged the car. Officers checked the area but didn't find that he had hit anything. He was about 15 miles from his home.

His arrest was recorded by an officer's dashcam video and released to the public.

Woods had the active ingredient for marijuana, two painkillers -- Vicodin and Dilaudid -- the sleep drug Ambien and the anti-anxiety drug Xanax in his system but no alcohol, according to a toxicology report released in August. He completed a drug treatment program in July.

Woods has said he had been self-medicating to relieve the pain from his fourth back surgery and insomnia.

The DUI arrest was the first time Woods had been in trouble since Thanksgiving weekend 2009, when he plowed his SUV into a tree and a fire hydrant outside his Windermere, Florida, home. That led to revelations that he had multiple extramarital affairs. He spent 45 days in a Mississippi clinic, where he was treated for an addiction, and in 2010, he and his wife, Elin Nordegren, divorced.

Woods' 79 PGA Tour victories and 14 major titles both rank No. 2 all time. He has not competed since February because of his back injury and is not expected to return this year. His last win was in August 2013.

Woods has said his back is improving. Even though he has been a nonfactor on the PGA Tour, Forbes Magazine lists Woods as the 17th best-paid athlete in the world in 2017, making $37 million, almost exclusively from endorsements.