Before becoming a successful solo artist, Hernandez was an acknowledged music producer, writing songs forAlexandra Burke, Travie McCoy, Adam Levine, Brandy, Sean Kingston, and Flo Rida. He also co-wrote the Sugababes' hit song "Get Sexy" and provided backing vocals on their album Sweet 7.His first musical appearance as a singer was in Far East Movement's second studio album Animal, featured on the track "3D". He was also featured on pastor and hip hop artist Jaeson Ma's debut single "Love" in August 2009. He reached prominence as a solo artist after being featured on and co-writing B.o.B's "Nothin' on You" and Travie McCoy's "Billionaire"; both songs peaked within the top ten of many charts worldwide. He said of them, "I think those songs weren't meant to be full-sung songs. If I'd sung all of "Nothin' on You", it might've sounded like some '90s R&B." Following this success, Mars released his debut extended play (EP), titled It's Better If You Don't Understand, on May 11, 2010. The EP peaked at the 99th position on the Billboard 200 and produced one single, "The Other Side", featuring singers Cee-Lo Green and B.o.B.Mars collaborated with Green once more in August 2010 by co-writing his single "Fuck You!". He performed a medley of "Nothin' on You" and "Airplanes" with B.o.B and Hayley Williams at the 2010 MTV Video Music Awards on September 12, 2010.
Mars' debut album, Doo-Wops & Hooligans, was released digitally on October 4, and saw its physical release on October 5, 2010. The lead single, "Just the Way You Are", was released on July 19, 2010, and has reached the top of the Billboard Hot 100 as well as several other charts worldwide. The music video was released on September 8, 2010.The second single, "Grenade", was released September 28, 2010, and has also seen successful international chart performance. In the United States, Doo-Wops & Hooligans debuted at number three on the Billboard 200 for the week of October 13, 2010, selling 55,000 copies. The album also received generally positive reviews from critics. Entertainment Weekly's Leah Greenblatt praised Mars for his "instant-access melodies" and "sly snatches of dance-floor swagger", but noted weaknesses in songs deviant from his conventional pop and soul genres. He opened for Maroon 5 on the fall leg of the Hands All Over Tour starting October 6, 2010 and co-headlined with McCoy on a European tour starting October 18, 2010. On September 19, 2010, Mars was arrested in Las Vegas for possession of cocaine. When talking to a police officer, Mars reportedly stated that what he did was "foolish" and that "he has never used drugs before".Mars pled guilty to felony drug possession, and in return for his plea, the charges will be erased from his criminal record as long as he pays a $2,000 fine, does 200 hours of community service and completes a drug counseling course.