Ministers insisted their aim was only to clarify the Equality Bill and that the status quo would stay, but churches said it would create confusion.
Peers voted by majorities of 38, 21 and seven against government amendments.
The current law allows religious organisations to rule out some applicants on conscientious grounds.
The government tried to amend the bill so that exemptions to equality provisions applied only to those whose jobs "wholly or mainly" involved taking part in services or rituals, or explaining the doctrines of religion.
But the churches argued that many clergy spend only some of their time in these roles and carry out administrative and other duties.
During debates, both sides claimed they were defending the status quo, which allows religious organisations to reject candidates for particular roles on grounds such as gender, marital status and sexual orientation.
The Archbishop of York, the Most Reverend John Sentamu, told peers: "You may feel that many churches and other religious organisations are wrong on matters of sexual ethics.
"But, if religious freedom means anything it must mean that those are matters for the churches and other religious organisations to determine for themselves in accordance with their own convictions."