Rotate a cube to make it stand on one of its corners
Somewhat better non-mathematical solution:


Extrude one of the side edges along the 'Z axis' and split the extrusion with Y.
Set cursor location with Shift+S and pivot point with comma.
Enable vertex snapping, set 'Edge' snap element and 'Active' snap target.
Select the main object with L and make one vertex active with Shift-Click.
Rotate in front view and side view.


That's how it looks: