Peers backed an Enterprise and Regulatory Reform Bill amendment to add caste to race discrimination laws.
The government opposed the move, saying it had set up an education programme to tackle caste discrimination.
But peers said this was not enough, and the law needed to be changed. The government was defeated by 256 to 153.
The defeat was the second of the day for the government, with peers also challenging the government over the role of the Equality and Human Rights Commission in promoting a more equal society.
Ministers want to remove a general duty on the commission underlining the need to protect human rights and promote equal opportunity for all in society, but peers blocked the move.'Racial prejudice'
As the debate took place, more than 400 members of the Dalit community - so-called untouchables - protested outside Parliament.
The Bishop of Oxford Lord Harries of Pentregarth - who introduced the amendment - said the British Dalit community had reached 480,000 and evidence showed they suffered discrimination in education, employment and the provision of public goods and service.