Actor Robert Downey Jr has agreed to plead guilty to two drug charges in connection with his arrest last November at a Palm Springs hotel.

A U.S. magazine has reported that Downey's lawyers have reached an agreement that will allow the 36-year-old actor to spend up to a year in a drug rehabilitation facility and spare him a return to prison.

Downey checked himself into a drug rehab centre in April but prosecutors decided not to file charges in that case despite tests showing he had cocaine in his system.