But on Friday, the pair announced they were no longer together.
"We have decided to end our marriage. This was a very difficult decision," the couple said in a statement by Lopez's publicist. "We have come to amicable conclusion on all matters. It is a painful time for all involved and we appreciate the respect of our privacy at this time."
"It is a painful time for all involved," the statement continues, "and we appreciate the respect of our privacy at this time."
Lopez, 41, and Anthony, 42, married in 2004 and have 3-year-old twins, Max and Emme.
It was a surprising split for one of Hollywood's most high-profile couples. They seemed inseparable: Lopez even danced in the background for her crooner husband when he performed on "American Idol," where she debuted as a judge this past season.
The pair, both of Puerto Rican heritage, knew each other for years before the 2004 wedding. He was ending a marriage to former Miss Universe Dayanara Torres, while she had recently endured a high-profile breakup with Ben Affleck.
Lopez had been married twice before in brief unions to Ojani Noa and Chris Judd and had a famous romance with Sean "Diddy" Combs.
Her union with Anthony was her most enduring public relationship. The pair did a joint tour together and starred in the movie "El Cantante" in 2006.
They also had two children, twins Emme and Max. They were Lopez's first children; Anthony had a child from Torres and another from a previous relationship.
In April, the pair, both 42, announced plans for a television show together, "Q'Viva! The Chosen," with Simon Fuller, the creator of "Idol." The show was to feature the superstar couple as they traveled the world to find the best performers in Latin music, dance and other arts with the goal of creating a live extravaganza.
The show had no airdate, and it's unclear if it will continue.
Lopez released her latest album, titled "Love?" this year. Her career, which lulled in recent years, has surged since she became an "Idol" judge.