In my experience, in the order of importance:
1. hire qualified people
2. document all the requirements and business decisions
3. rigorous design reviews
4. mandatory code reviews
5. implement tests for each requirement
6. have a regression testing suite
7. have a user acceptance test environment, separate from production