Astronomers do this with something called the equatorial reference system which specifies the right ascension and declination of an object in the sky. This is closely analogous to longitude and latitude respectively but there are some important differences.
In order to understand this system, we have to first understand the concept of the celestial sphere. Imagine a large glass sphere around the Earth with stars painted on it (you can buy celestial globes which model this quite well – we have some in my Earth science lab). It's really the ancient view of the universe but it works well for our purposes.
Looking at the celestial globe above, you can see lines scribed on it that look like latitude and longitude lines. Those are the declination and right ascension lines. Declination, abbreviated with the Greek lowercase “d” or d, is analogous to latitude and right ascension, abbreviated with the Greek lowercase “a” or a, is analogous to longitude.
Now imagine extending the north and south poles of the Earth out to the celestial sphere. You’ve now defined the north and south celestial poles. Extend the Earth’s equator outward to define the celestial equator. With me so far?
Declination at the celestial equator is 0º, declination at the north celestial pole is +90º, and declination at the south celestial pole is -90º (N and S are not used in declination, only +/-). That's easy.
Right ascension, however, is a bit different. Because the Earth rotates once on its axis in 24 hours, there are 24 hour lines of right ascension (subdivided into minutes and seconds). This differs from longitude on Earth (which has 0-180º E and 0-180º W). The 24 hours of right ascension increase to the west (clockwise around the celestial globe as viewed from above its North Pole).
This time of year, a prominent star in the evening sky is Vega. Vega has a declination of +38º 47’ 37” (almost 39º north of the celestial equator). It has a right ascension of 18h 37m 18s (the abbreviations are hours, minutes, and seconds). It always has the same declination and right ascension, not matter what time of day or night or what location on Earth you’re viewing it from. In order to understand why that is, we have to complicate things a bit.
When looking at the celestial globe, imagine that the Earth is fixed and not moving. Then imagine the celestial sphere rotating around the Earth once every a day (there’s a complication here, it’s actually once every 23 hours and 56 minutes, not 24 hours, because the Earth is also going around the Sun as it rotates but don't worry about that here). So the star, and the declination/right ascension coordinate system ,are both rotating around the Earth (that’s why the star’s declination and right ascension are constant even though we see the stars moving through the sky during the course of the night - the coordinate system is moving too).
Now, just as with longitude on the Earth, there’s a problem when setting up right ascension. Where do you place the 00 hour line of right ascension? Once again, it’s arbitrary but a logical place was chosen. To understand, another complication must be discussed!
Look back at the celestial globe picture again. Notice how the north and south pole of the Earth are not oriented vertically but tilted. The amount of tilt is 23.5º from vertical. Why? Because the Earth’s axis is tilted by that amount. Tilted with respect to what? Tilted with respect to the Earth’s orbit around the Sun called the plane of the ecliptic. Imagine all of the planets in our solar system orbiting the Sun. They all orbit (roughly) in the same plane. From here on Earth, we see the Sun move across the sky between sunrise and sunset. The Sun is following the path of the ecliptic in the sky (on the Sun, we’d see the Earth following the path of the ecliptic in the sky – it goes both ways!). In the image below, all the planetary orbits define the plane of the ecliptic.
Back to the celestial globe. See the band of metal circling the celestial globe dividing it in half horizontally? That’s essentially where the ecliptic would be located. See the seam on the celestial globe halfway between the celestial poles? That’s the celestial equator. Note that the plane of the celestial equator and the plane of the ecliptic are at an angle from each other (a 23.5º angle). The band of the ecliptic and the band of the celestial equator intersect each other at two points. One of these points is defined as the 00 hour of right ascension. It actually corresponds physically to the spring or vernal equinox (the other intersection is the fall or autumnal equinox).
Examine the picture above. It shows the celestial sphere. The red line with the Sun on it is the ecliptic and the blue line is the celestial equator. Where they intersect is the vernal equinox. That’s the 00 hour line of right ascension.
Also note, in this figure, that right ascension hours increase to the right (counterclockwise when looking down from above the north celestial pole). Why? Because the celestial sphere is rotating around the Earth from east to west in a clockwise direction (imagine standing on the stationary Earth inside the celestial sphere, you’d see stars rising in the east and setting in the west just as you do in real life).
When you understand right ascension and declination, you now can look up the "address" of any object in the sky and know where it's located.