Yes, Sri Rama and Krishna spared the lives of their opponents on some occasions.
First incident is from Ramayana, Bala Kanda where Sri Rama spared the life of Mareecha in at sage Vishwamitra yajna.
Lakshmana, I am reluctant to eliminate this kind of these ill-behaved and raw flesh eating demons, but no doubt, they will be puffed out with Manava missile like a gust puffing thick clouds, you may see." Thus Rama said to Lakshmana. [1-30-15, 16a]
Cleanly hit with that great missile Maanava, demon Maareecha is pitched for a hundred yojana lengths in full, and flung down into an ocean rocking with tidewaters. [1-30-18]
On seeing him highly whirling, rendered insensate and thrown out when rammed away with the strength of that Cold arrow Rama said this to Lakshmana. [1-30-19]
Lakshmana, see the Cold arrow belonging to Maanava missile expounded by Manu which is taking him away on baffling, but without taking away his life. [1-30-20]
Though later Mareecha was killed by Sri Rama when he was in form of golden deer.
Lord Rama has also spared the life of Jayanta (son of Indra) when he was trying to do harm to Devi Sita.
That Rama, who affords protection, was compassionate and protected that crow, which fell on the ground (in salutation to Rama) and sought for protection, eventhough it was apt to be killed.
Sri Krishna has also spared the life of Banasura. This story is mentioned in Srimada Bhagavatam, Canto 10.
SB 10.63.46 — The Supreme Lord said: My dear lord, for your pleasure We must certainly do what you have requested of Us. I fully agree with your conclusion.
SB 10.63.47 — I will not kill this demonic son of Vairocani, for I gave Prahlāda Mahārāja the benediction that I would not kill any of his descendants.
SB 10.63.48 — It was to subdue Bāṇāsura’s false pride that I severed his arms. And I slew his mighty army because it had become a burden upon the earth.
SB 10.63.49 — This demon, who still has four arms, will be immune to old age and death, and he will serve as one of your principal attendants. Thus he will have nothing to fear on any account.