Yes, within limits. Mounted on a tripod, a recent smartphone in night or manual mode can photograph the Moon through an eyepiece, planetary conjunctions, constellations, auroras and even the Milky Way under a dark sky. Its small sensor, however, limits deep-sky imaging and planetary detail.
The Moon is the ideal target. Simply hold the phone's lens against the eyepiece of a telescope or binoculars, ideally with an adapter that keeps it centered: this is called the afocal method. Craters show up clearly, even with a small instrument. Lower the exposure on screen, since the Moon is very bright.
For wide-field shots of the night sky, a tripod is essential. Night modes automatically combine several exposures; manual modes, where available, allow exposures of 10 to 30 seconds and saving in RAW format, which is easier to process. Set focus to infinity and use the self-timer. Smartphones also capture the colors of auroras very well, often more vividly than the eye sees them.
Planets are harder: through a telescope, you record a few tens of seconds of video, then software keeps only the sharpest frames and combines them (lucky imaging). The deep sky remains the main limitation: a small sensor, high noise and a wide-angle lens only reveal the brightest nebulae and galaxies. The phone's automatic processing can also smooth or distort stars. To progress further, an interchangeable-lens camera or a smart telescope takes over.
In practice
Key terms
More questions: Photographing the sky
Sources: D. L. Fried, Journal of the Optical Society of America, 1978 (probability of a lucky short-exposure image through turbulence)