A computer-readable storage medium having stored therein an information processing program executed by a computer of an information processing apparatus for performing a process determined in accordance with an orientation of an input device, the input device including imaging means, motion detecting means for detecting a motion of the input device and an imaging information calculation section, and the information processing program causing the computer to execute: a first calculating step of calculating, as a first tilt, a tilt of the input device relative to a rotation thereof around an imaging direction of the imaging means as a predetermined axis direction of the input device in accordance with a tilt of images of predetermined imaging targets comprising a marker section included in a captured image captured by the imaging means, the tilt of images being relative to the captured image; a second calculating step (S23, S24) of calculating, as a second tilt, the tilt of the input device relative to the rotation thereof around the predetermined axis direction of the input device in accordance with a detection result of the motion detecting means; a determining step of determining, based on a state of the imaging targets being captured by the imaging means, whether or not it is possible to calculate the first tilt in the first calculation step; and an orientation calculating step of calculating an orientation of the input device by using the tilt calculated in the first calculation step when the determining step determines that it is possible to calculate the tilt of the input device in the predetermined direction, and by using the tilt calculated in the second calculation step when the determining step determines that it is impossible to calculate the tilt of the input device in the predetermined axis direction. a first calculating step of calculating, as a first tilt, a tilt of the input device relative to a rotation thereof around an imaging direction of the imaging means as a predetermined axis direction of the input device in accordance with a tilt of images of predetermined imaging targets comprising a marker section included in a captured image captured by the imaging means, the tilt of images being relative to the captured image; a second calculating step (S23, S24) of calculating, as a second tilt, the tilt of the input device relative to the rotation thereof around the predetermined axis direction of the input device in accordance with a detection result of the motion detecting means; a determining step of determining, based on a state of the imaging targets being captured by the imaging means, whether or not it is possible to calculate the first tilt in the first calculation step; and an orientation calculating step of calculating an orientation of the input device by using the tilt calculated in the first calculation step when the determining step determines that it is possible to calculate the tilt of the input device in the predetermined direction, and by using the tilt calculated in the second calculation step when the determining step determines that it is impossible to calculate the tilt of the input device in the predetermined axis direction.