The annual Iftar was attended by eminent Muslim Americans and member of the diplomatic corps from Islamic countries including those from Bangladesh and Pakistan.
"When our values are threatened, we come together as one nation. When three young Muslim Americans were brutally murdered in Chapel Hill earlier this year, Americans of all faiths rallied around that community," Obama said in his address to the guests.
Traditional Iftar dinner follows daily fasting from dawn to dusk. Ramadan ends with the Islamic holiday of Eid al-Fitr.
"Our annual White House Iftar recognises the sacredness of Ramadan to more than 1.5 billion Muslims around the world. It is a time when Muslims recommit themselves to their faith, following days of discipline with nights of gratitude for the gifts that God bestows," Obama said.
More From This Section
"Challenges around the world and here at home demand the very qualities you summon every day during Ramadan - sacrifice, discipline, patience. A resilience that says we don't simply endure, but we overcome," Obama said.
"Together, we can overcome ignorance and prejudice. Together, we will overcome conflict and injustice - not just with words, but with deeds. With what a hero of mine, civil rights icon John Lewis, calls using our feet - getting out in the real world to organise and to create the change that we seek," he said.
"That is what so many of you do every single day. And that is what we have to continue to do together here in America and around the world. As the Quran teaches, let us answer with "Peace", Obama added.