Begind with rendering a diffuse pass and an alpha pass. Save as layered (psd) or as separate images. Locate or create a fitting background.
Arrange your layers as below.
Select the background and create a vector mask (click the icon in the red circle). Select and copy the content in your alpha layer.
Select your background layer and click on the channels tab. Paste your alpha image into the Background mask channel.
Go back to the layers tab, and invert the background mask (edit menu-> invert). Click on the background image. Voilá, you're done! If you wish you can unclick the chain icon
and move around the background independently of the foreground image.