By 52-44, senators also endorsed Obama's pick of Staci Yandle, an openly gay black woman, to serve on a federal district court in Illinois. While that is not a first, the White House said that vote was a landmark because it brought to 112 the number of female federal judges appointed by Obama, more than any previous president.
In a third roll call, the Senate voted 92-4 to make Salvador Mendoza a federal district judge in Washington state. The White House said Obama has now appointed the most Hispanics, 31, to the federal bench of any president.
Presidential counsel Neil Eggleston called it "a historic day for our judiciary'' in a blog post.
"These milestones are important not because these judges will consider cases differently, but because a judiciary that better resembles our nation instills even greater confidence in our justice system'' and can serve as a future role model, Eggleston wrote.
Appointments to top-tier federal judgeships, the Supreme Court, circuit courts of appeals and district courts, are lifetime.
President Bill Clinton appointed 111 women to the federal judiciary, while 30 Hispanics became judges under President George W. Bush, the White House said.
Obama nominated Gayles after Sen. Marco Rubio, R-Fla., blocked a previous openly gay black nominee, Gayles' fellow Miami-Dade Circuit Judge William Thomas. Rubio said he opposed Thomas because of decisions Thomas made in some cases.