The founder of the dynasty was Sebüktigin (ruled 977–997), a former Turkic slave who was recognized by the Sāmānids (an Iranian Muslim dynasty) as governor of Ghazna (modern Ghaznī, Afghanistan). As the Sāmānid dynasty weakened, Sebüktigin consolidated his position and expanded his domains as far as the Indian border. His son Maḥmūd (ruled 998–1030) continued the expansionist policy, and by 1005 the Sāmānid territories had been divided. The Oxus River (Amu Darya) formed the boundary between the two successor states to the Sāmānid empire, the Ghaznavids ruling in the west and the Qarakhanids in the east.

Ghaznavid power reached its zenith during Maḥmūd’s reign. He created an empire that stretched from the Oxus to the Indus valley and the Indian Ocean; in the west he captured (from the Būyids) the Iranian cities of Rayy and Hamadan. A devout Muslim, Maḥmūd reshaped the Ghaznavids from their pagan Turkic origins into an Islamic dynasty and expanded the frontiers of Islam. The Persian poet Ferdowsī (d. 1020) completed his epic Shāh-nāmeh (“Book of Kings”) at the court of Maḥmūd about 1010.

Maḥmūd’s son Masʿūd I (reigned 1031–41) was unable to preserve the power or even the integrity of the Ghaznavid empire. In Khorāsān and Khwārezm, Ghaznavid power was challenged by the Seljuq Turks. Masʿūd suffered a disastrous defeat at the Battle of Dandānqān (1040), whence all the Ghaznavid territories in Iran and Central Asia were lost to the Seljuqs. The Ghaznavids were left in possession of eastern Afghanistan and northern India, where they continued to rule until 1186, when Lahore fell to the Ghūrids.

Little survives of Ghaznavid art, but the period is important for its influence on the Seljuq Turks in Iran and on later Islamic art in India. The Ghaznavids introduced the “four eyvān” ground plan in the palace at Lashkarī Bāzār near Lashkarī Gāh, on a plateau above the Helmond River, just north of Qalʾeh-ye Best, Afghanistan. An eyvān is a large vaulted hall, closed on three sides and open to a court on the fourth. The motif of a court surrounded by four eyvāns dominated Seljuq mosque architecture and was used continually through the Timurid and Ṣafavid periods in Persia. The victory tower of Masʿūd III (built 1099–1115) is a precursor of the Seljuq türbe, or tomb-tower. Of its two original stories, the remaining one is largely covered with ornamental inscription. Excavations at the site of the palace at Lashkarī Bāzār have uncovered figurative paintings whose stylistic elements are similar to early Seljuq work.