The first thing to determine is if only write access to the web site's document root was achieved or if the operating system itself has been compromised.
If your site was only defaced, you need to patch or reconfigure your web stack so it doesn't happen again. And restore your content from known good backups.
If the OS was compromised, you must format and reinstall everything. This is because 'root kits' may be undetectable once they are installed by attackers.
Depending on the risk to other systems, if the OS is not open source I always format and reinstall.