1) Airbus A340 - No crashes
2) Boeing 777 - 5 crashes, 2 intentional (Malaysia x2), 1 engine-related (Rolls-Royce problem), 2 pilot-error (Asiana/Dubai) - [Thanks fishywang]
3) Boeing 747-8
4) Boeing 737-NG
5) Boeing 767
6) Airbus A320
7) Boeing 757
1) Airbus A340 - No crashes
2) Boeing 777 - 5 crashes, 2 intentional (Malaysia x2), 1 engine-related (Rolls-Royce problem), 2 pilot-error (Asiana/Dubai) - [Thanks fishywang]
3) Boeing 747-8
4) Boeing 737-NG
5) Boeing 767
6) Airbus A320
7) Boeing 757
The popularity of A320 and 737-NG makes their safety records particularly impressive.
Luck and good fortune also played a huge role of course. What the pilots did was unconscionably neglectful. CFIT is often (usually?) fatal for all passengers.
*EDIT: It's similar to software that's written to be extremely robust that encounters an unexpected error (or set of errors). The software wasn't necessarily designed to handle it, but sometimes it can nonetheless.
That isn't really something engineers can design to. What happens is the aerodynamics group calculates the maximum loads on the airplane. This is increased by 50% and called the "ultimate load", and the parts are all designed to not break up to that load.
Parts stronger than that are overweight, and weight is the enemy of all airplanes.
After parts are designed, they go through an independent "stress" group which verifies that the parts meet the strength requirements.