After a five-hour meeting with their attorneys present, Spears and Federline signed "a global settlement on all issues of their marriage," said Michael Sands, a spokesman for Federline's attorney Mark Vincent Kaplan.
Federline will receive $1 million and will share joint custody with Spears, sources told TMZ.
Sands declined to elaborate on terms of the settlement, saying only that it covers child custody and financial matters.
Spears' attorney, Laura Wasser, declined to comment.
The settlement came more than a week after Spears checked out of a luxurious rehab center. During her nearly one-month stay at Promises Malibu Alcohol and Drug Rehab Treatment Facility, Spears and Federline were under a temporary agreement that gave them joint custody of their two young sons.
When Spears filed for divorce on Nov. 7, the pop star cited irreconcilable differences as the reason for ending her two-year marriage to Federline. She sought custody of the children, with visitation rights for Federline.
Federline counter-filed court papers the following day seeking sole custody of their boys — 6-month-old Jayden James and 18-month-old Sean Preston — and for spousal support.