For the cube shown I want to do a rotation on the cubes local z axis so that the cubes local x axis lies on the global xz plane.
Select the cube, Shift S > Cursor to Selected, choose 3D Cursor as current pivot point, or simply press . (the period key).
Press Numpad 1, add a plane object, press F6 then toggle Align to View, in order to make it parallel to global XZ plane.
Select the cube, then View > Align View > Align View to Active > Top (or simply press Shift Numpad 7), then add another plane object, toggle Align to View in F6 panel, as well.
Keep current View unchanged, add an empty object, toggle Align to View in F6 panel, as well. G X X to move a certain distance along its local X axis.
Add a Boolean modifier to either one of the plane, set Boolean mode to Intersect, choose another plane as the target object, in order to generate the intersection line from two planes.
Enable Snap icon on 3D View header, choose Edge as snap element, and Active as snap target, first select the cube, then select the empty by holding Shift to make it active, R Z Z, move mouse over the intersection line generated in Step 3, until it is snapped, LMB or Enter to confirm. Finally, delete these extra objects.