The exes had been scheduled to appear in court in New York City today. Details of the settlement were not made public, but Ritchie's attorney said in a statement to ABC News that Rocco will remain in London.
"Guy Ritchie is delighted to have this case behind him. Everybody in the family is happy that an agreement has been reached and Rocco can continue to live with his father in London."
New York State Supreme Court Judge Deborah Kaplan, the presiding judge in the case, had implored the "Rebel Heart" singer and the "Sherlock Holmes" director, who filed for divorce in 2008 after eight years of marriage, to resolve the matter out of court.
The dispute dates back to December, when Rocco, now 16, left his mother's concert tour to live with Ritchie in London. Madonna then appealed to a New York court for his return. Although Judge Kaplan ordered Rocco to return to New York, she was unwilling to issue a warrant when he did not.
So Rocco remained in London, where he was enrolled in school, while his parents tried to work out a deal. In March, a court-appointed attorney representing Rocco told the court the teen was stressed over the dispute.
Mother and son were reunited in London in May. The following month, they were spotted at an off-Broadway show in New York. Rocco accompanied his famous mother to Cuba in August to celebrate her 58th birthday.
"In my Universe there are 2 Suns!" she wrote. "Best Birthday ever!"
ABC News' Shahriar Rahmanzadeh also contributed to this report.