Not masochism..! Sadism is the derivation of pleasure from others' suffering. Is there a word for the derivation of pleasure from others' happiness?
Yes! The word is compersion. It is common among those interested in or practicing polyamory and it is becoming more common in general use as well. Parents are well acquainted with the concept -- I had tears of joy streaming down my face watching my daughter perform at Disneyland recently.
The feeling of joy one has experiencing another's joy, such as in witnessing a toddler's joy and feeling joy in response.
The feeling of joy associated with seeing a loved one love another; contrasted with jealousy.
Hope this helps. (I would get a lot of joy from your happiness at learning this word! 8^)