Is it safe to simply replace a heating element in an electric water heater?
Possibly, but without seeing the extent of the damage no one will be able to tell for sure.

Given that you have already replaced the element I'd keep a close eye on the heater for a few days to make sure that there are no problems.

Did you clean everything and check for further damage before you reassembled the heater?