The Masjid-i Imam, formerly known as Masjid-i Shah, was built on the south side of Isfahan's maydan, the royal square of Isfahan, that had been built under Shah 'Abbas. 'Abbas moved the capital of the Safavid dynasty to Isfahan in 1597 with the goal of centering political, religious, economic, and cultural activities, in the process shifting Isfahan's center away from the area surrounding the old Friday mosque in the north and relocating it closer to the Zayandeh river. The Masjid-i Shah was Shah 'Abbas's largest architectural monument. The mosque's monumental portal iwan is located exactly opposite the portal iwan on the northern arcade of the maydan, which connects the maydan to the old bazaar to the north. Construction of the Masjid-i Shah began in 1611 under Shah 'Abbas, and was completed around 1630 during the rule of Shah Safi, 'Abbas's successor, who ruled from 1629 to 1642. Later, in 1638, marble dadoes were added to the structure. Much is known about the people who were involved in the mosque's construction from the inscriptions installed on the building, which identify Badi' al-Zaman Tuni as responsible for the building plans and site arrangement, 'Ali Akbar Isfahani as the engineer, and Muhibb 'Ali Beg as the general contractor.
From the center of the southern wall of the maydan, one enters the mosque through a recessed vestibule where the main portal to the mosque is located on the vestibule's southern wall. This area connects on its two other sides (east and west) to the maydan's corridor, which runs behind its mercantile facilities. Only the vestibule follows the maydan's orientation (north-south). The rest of the mosque, rectangular in shape (100 by 130 meters), is rotated 45 degrees to orient it toward Mecca, according to which the qibla wall is installed. To achieve this orientation toward Mecca the main portal is connected to a triangular vestibule, which connects it to the mosque's courtyard via the space behind the northeast iwan.
Following the Iranian traditional mosque plan, the Masjid-i Shah has a court (50 by 67 meters) surrounded by a two-story arcade on four sides with four iwans, one at the center of each side, and a domed sanctuary behind the southwest iwan, oriented towards Mecca. However, the mosque's plan presents an interesting variation: behind each lateral iwan (on the northwest and southeast) is a domed chamber. The domed sanctuary behind the southwest iwan is flanked by rectangular rooms (36 meters by 18 meters each) functioning as winter prayer halls that are entered from the domed sanctuary aligned on the northeast-southwest axis. These halls are covered by eight domes and connect to two rectangular arcaded courts serving as madrasas (22 by 44 meters each) also aligned on the northeast-southwest axis and are only accessed from the domed chambers behind the southeast and northwest iwans, respectively. Both the main portal iwan, overlooking the maydan, and the sanctuary iwan are flanked by a pair of soaring cylindrical minarets 34 meters in height. These minarets are decorated with tile mosaics of epigraphic elements ("no God but God"). On top of its upper zone runs an inscription band in white on a blue background, marking the beginning of three tiers of muqanas units, each unit outlined with yellow lines and inscribing a floral arabesque mainly in blue. These muqarnas appear to hold the minaret's roofed balcony, which wraps around a cylindrical core narrower than the lower shaft of the minaret.
The prelude to the mosque, the main portal iwan located on the south arcade of the maydan, was finished in 1616, prior to the rest of the building, so that it could complete the southern facade of the maydan. The portal was covered with tile mosaic above a continuous marble dado, and achieved an extraordinary monumentality through its immense scale, as its arch rises almost twenty-eight meters. It is framed by an inscription band of white thuluth script with a dark blue background. The arch is ornamented with a turquoise triple-cable frame springing from a vase-like marble base (pedestal). The main portal iwan is surmounted by tiers of muqarnas forming a semi-dome. Two large tiled panels, resembling a prayer carpet, flank the main door, above which an inscription band, also in white script on a dark blue background, identifies Ali Reza as the calligrapher, 1616 as the year of the execution, and the name of the patron Shah 'Abbas in the center in light blue.
In the court, the iwan preceding the domed sanctuary is larger than the other three iwans at the centers of the two-story arcades. The dome of the sanctuary is vast in scale (25 meters across by 52 meters high), and, like most Timurid prototypes, comprises two shells, the bulbous dome being fourteen meters higher than the interior dome. On the exterior, the bulbous dome is covered with a spiraling beige arabesque on a light blue background. The dome rises on a high drum and a sixteen-sided transitional zone. The interior of the dome is ornamented with a sunburst at the apex from which descend tiers of arabesque. The eight domes in each of the prayer halls adjacent to the domed sanctuary are decorated with mosaic tilework of concentric medallions in floral motifs. The arches on which these domes rest ascend from undecorated octagonal columns that divide the space of these halls into eight bays.
The mosque's interior and exterior walls are fully covered with a polychrome, mostly dark blue, glazed tile revetment above a continuous marble dado. Throughout the whole mosque, with the exception of the sanctuary dome and portal iwan, Shah 'Abbas was keen to minimize labor costs and time by introducing a novel technique called "haft-rangi" (seven colors). Instead of the Timurid and early Safavid tile mosaic, in which each tile piece was cut in a different shape to fit its designated place, the haft-rangi is usually a square tile that incorporates various colors in one firing. This technique, aesthetically less complex than mosaic tile technique, economical, and fast, was juxtaposed to the mosaic tile technique. It glitters in the sun to magnificent effect, but is ill-suited to dark spaces, such as the sanctuary. Most of the tilework was replaced in the 1930s based on the revetment that remained in situ. Water is an important element in the design; both the main court and the courts of the madrasas have pools at their center reflecting the architectural splendor of the Masjid-i Shah.