Shamash (Akkadian Šamaš "Sun") was a native Mesopotamian deity and the sun god in the Akkadian, Assyrian and Babylonian pantheons. Shamash was the god of justice in Babylonia and Assyria, corresponding to Sumerian Utu. Akkadian šamaš is cognate to Hebrew שמש šemeš and Arabic شمس šams.

Both in early and in late inscriptions Shamash is designated as the "offspring of Nannar"; i.e. of the moon-god, and since, in an enumeration of the pantheon, Sin generally takes precedence of Shamash, it is in relationship, presumably, to the moon-god that the sun-god appears as the dependent power. Such a supposition would accord with the prominence acquired by the moon in the calendar and in astrological calculations, as well as with the fact that the moon-cult belongs to the nomadic and therefore earlier stage of civilization, whereas the sun-god rises to full importance only after the agricultural stage has been reached.

The two chief centres of sun-worship in Babylonia were Sippar, represented by the mounds at Abu Habba, and Larsa, represented by the modern Senkerah. At both places the chief sanctuary bore the name E-barra (or E-babbara) "the shining house"—a direct allusion to the brilliancy of the sun-god. Of the two temples, that at Sippara was the more famous, but temples to Shamash were erected in all large centres – such as Babylon, Ur, Mari, Nippur, and Nineveh.

It is evident from the material at our disposal that the Shamash cults at Sippar and Larsa so overshadowed local sun-deities elsewhere as to lead to an absorption of the minor deities by the predominating one. In the systematized pantheon these minor sun-gods become attendants that do his service. Such are Bunene, spoken of as his chariot driver and whose consort is Atgi-makh, Kettu ("justice") and Mesharu ("right"), who were then introduced as attendants of Shamash. Other sun-deities such as Ninurta and Nergal, the patron deities of other important centers, retained their independent existences as certain phases of the sun, with Ninurta becoming the sun-god of the morning and spring time and Nergal the sun-god of the noon and the summer solstice. In the wake of such syncretism Shamash was usually viewed as the sun-god in general.

Together with Nannar-Sin and Ishtar, Shamash completes another triad by the side of Anu, Enlil and Ea. The three powers Sin, Shamash and Ishtar symbolized three great forces of nature: the moon, the sun, and the life-giving force of the earth, respectively. At times instead of Ishtar we find Adad, the storm-god, associated with Sin and Shamash, and it may be that these two sets of triads represent the doctrines of two different schools of theological thought in Babylonia which were subsequently harmonized by the recognition of a group consisting of all four deities. The consort of Shamash was known as Aya. She is, however, rarely mentioned in the inscriptions except in combination with Shamash.

Another reference to Shamash is the Babylonian epic Gilgamesh. When Gilgamesh and Enkidu travel to slay Humbaba, each morning they pray and make libation to shamash in the direction of the rising sun for safe travels. Gilgamesh receives dreams from Shamash, which Enkidu then interprets, and at their battle with Humbaba, it is Shamash's favor for Gilgamesh that enables them to defeat the monster.

God of law, justice and salvation

The attribute most commonly associated with Shamash is justice. Just as the sun disperses darkness, so Shamash brings wrong and injustice to light. Hammurabi attributes to Shamash the inspiration that led him to gather the existing laws and legal procedures into code, and in the design accompanying the code the king represents himself in an attitude of adoration before Shamash as the embodiment of the idea of justice. Several centuries before Hammurabi, Ur-Engur of the Ur dynasty (c. 2600 BCE) declared that he rendered decisions "according to the just laws of Shamash."

It was a logical consequence of this conception of the sun-god that he was regarded also as the one who released the sufferer from the grasp of the demons. The sick man, therefore, appeals to Shamash as the god who can be depended upon to help those who are suffering unjustly. This aspect of the sun-god is vividly brought out in the hymns addressed to him, which are, therefore, among the finest productions in the entire realm of Babylonian literature.

From: Wiki
The sun. For the Sumerians he was principally the judge and law-giver with some fertility attributes. For the Semites he was also a victorious warrior, the god of wisdom, the son of Sin, and 'greater than his father'. He was the husband and brother of Ishtar. Shamash is represented with the saw with which he cuts decisions. In the Mesopotamian poems 'Shamash' may mean the god, or simply the sun.

From: Here
Utu is the Sumerian Sun God, whose Akkadian name is Shamash. He represents the brilliant light of the sun, which returns every day to illuminate the life of mankind, as well as the heavenly Force that brings the warmth which causes plants to grow. Utu´s pictographic sign appears already in the earliest written cuneiform records.

Several Old Sumerian kings speak of Utu as their king, and this can be attested by the kings´ name forms, which may include the name of the god or his epithets in it. In the Sumerian tradition, Utu is the son of Nanna, the Moon Lord and his consort Ningal, and twin brother of Inanna, the Great Goddess of Love and War, showing therefore that the Light of the Day came from the Torch of the Night and the Lady of Dreams. Nanna and Ningal had another son, the patron god of weather changes and holder of thunderbolts, Ishkur or Adad, Utu´s younger brother. In Akkadian tradition, Utu/Shamash is sometimes the son of Anu, the Skyfather, or Enlil, the Air Lord. Utu´s consort is Sherida (Sumer) or Aya (Akkadian for dawn). The two principal temples of Utu were both called E-babbar, or White House, and were located in Sippar (in the North) and Larsa in Southern Sumer. Thorkild Jacobsen mentions in The Treasures of Darkness that Utu´s/Shamash´s main characteristics is Righteousness, for He is the power in the light that reveals all that is to be seen, and the foe of darkness and deeds of darkness. Thus, in the social plane, Utu becomes a power for justice and equity.

Utu´s social role is therefore as guardian of justice, as judge of gods and men. In such position, he presides in the morning in cournts such as the one we know from the Bathhouse Ritual, where demons and other evildoers are sued by their human victims. At night, Utu/Shamash judges disputes among the dead of the Underworld. He is the last appeal of the wronged, who can obtain no justice from their fellow men, and their cry of despair to him, i-Utu, was feared as possessing supernatural power.

Basically, each morning Utu rises from the 'interior of heaven' with rays out of his shoulders in the East and crosses the firmament and all heavenly luminaries before finally reentering through the corresponding set of gates in the west. This means the Sun god travels to the Underworld everyday, becoming one of its Luminaries of the Land of No Return during nightime. Thus, Utu/Shamash is one of the Ever-Returning Deities of Mesopotamia, who travel to the Depths Below entering its Gates at Sunset and returning to brighten up the Heights Above at dawn every single day. The West Gates where the Sun sets in the Epic of Gilgamesh are said to be guarded by the Scorpion People, beings half human, half scorpion, the first Otherworld challengers Gilgamesh had to meet and win over in his search for immortality. Utu/Shamash travels the skies either on foot or in a chariot, pulled by fiery mules. His domain is called in The Phoenician Letters (by Wilfrid Davies and G. Zur, Mowat Publishing, Manchester, UK, 1979) the High Country, the heavenly sphere where the stars can be found.

In terms of character, Utu/Shamash is the Light that All Sees, and thus regarded as a god of truth, justice, and right. Thus his association to law and order, as well as a provider of clarity for oracles. I guess we could very much express the law-giving powers of Utu/Shamash as being the Spirit or Soul of the Law, i.e. He rules over the facts and acts which should guide righteous living, the standards for truthful action and deeds in the world, thus being the god for omens and oracles, because His is also the Will of the Ensouled Universe. Marduk, on the other hand, can be associated with the Law in the sense of being the Letter of the Law, the power that should be applied to Perfection to ensure the prosperity of the land. What the Spirit of the Law dictates (Utu/Shamsh) is accomplished by the coding of Harmonious Living, or the Power of Marduk. Utu/Shamash together with the storm-god Adad, he was often invoked in extispicy rituals.

From: Gateways to Babylon (more info @ link)
Shamash was a Sun god according to the Sumerian mythology. Sumerians were living more than three thousand years ago in Mesopotamia. The region of Mesopotamia corresponds to the valleys of Tigris and Euphrates rivers.

Since he could see everything on Earth, he represented also the god of justice. That is why Shamash was depicted as a ruler seated on a throne. Shamash and his wife, Aya, had two important children. Kittu represented justice, and Misharu was law.

Every morning, the gates in the East open up, and Shamash appears. He travels across the sky, and enters the gate in the West. He travels through the Underworld at night in order to begin in the East the next day.

In Babylon, located in the south of Mesopotamia, the symbol of Shamash was the solar disk, with a four-pointed star inside it.

From: here
Also see:
A hymn to Utu
(Utu B): translation

Great Hymn to Shamash