RIO DE JANEIRO — Brazil’s government has enacted one of the Western Hemisphere’s most sweeping affirmative action laws, requiring public universities to reserve half of their admission spots for the largely poor students in the nation’s public schools and vastly increase the number of university students of African descent across the country.

The law, signed Wednesday by President Dilma Rousseff, seeks to reverse the racial and income inequality that has long characterized Brazil, a country with more people of African heritage than any nation outside of Africa. Despite strides over the last decade in lifting millions out of poverty, Brazil remains one of the world’s most unequal societies.

“Brazil owes a historical debt to a huge part of its own population,” said Jorge Werthein, who directs the Brazilian Center for Latin American Studies. “The democratization of higher education, which has always been a dream for the most neglected students in public schools, is one way of paying this debt.”

As in the United States, affirmative action has stirred controversy and opposition here, even at some of the state universities that are exempt from the new law and have their own programs to admit underprivileged students. Critics contend that enforcing expansive quotas will undercut the quality of Brazil’s public university system, given the nation’s relatively weak public elementary and secondary schools. “You don’t create capable and creative people by decree,” said Leandro Tessler, institutional relations coordinator at the University of Campinas.