The government of the Ming dynasty of China (1368–1644) was modeled after the Mongol-led Yuan dynasty. Over time, the government system changed and adapted to circumstances. The Ming government was traditionally divided into three branches—civil, military and surveillance, with the imperial household and its eunuchs holding a distinct position.

In the beginning, the central civil authorities were led by the Central Secretariat, which oversaw Six Ministries and other less significant institutions. The Chief Military Commission served as the high command of the army, while the Censorate held the highest control authority. The empire was divided into two metropolitan areas and thirteen provinces, each of which was managed by a Branch Secretariat. The lower levels of administration included prefectures and subprefectures, with the lowest level being the counties. There were approximately 1,400 counties in Ming China.

In 1376, the Branch Secretariats were abolished and replaced by three provincial offices: the Provincial Administrative Office, the Regional Military Commission, and the Provincial Surveillance Office. Four years later, a reorganization took place in the center as well. The Central Secretariat was abolished, the Chief Military Commission was divided into five Chief Military Commissions, and the Censorate was also divided. In the following decades, there was a trend towards centralization once again. The Censorate was restored under a new name, and the role of the Secretariat was taken over by the new Grand Secretariat. Additionally, provincial governors or grand coordinators were appointed to oversee all three provincial offices. Initially, these governors were sent to the provinces on a temporary basis, but eventually, they were permanently stationed there.

The civil administration was primarily staffed by Confucian-educated officials who had passed a rigorous multi-stage examination process to verify their education. Junior officer positions were often passed down through families, while senior officers were chosen based on their abilities. Palace eunuchs also played a significant role in the government, and although initially prohibited from involvement in politics, they gained influence following the Yongle era.

Institutions and authorities Over the course of two thousand years, the structure of executive power in China remained largely unchanged, with each dynasty making additions as they saw fit. The Han dynasty established the "Three Departments and Six Ministries" system for central administration, while the Ming dynasty had only one office—the Central Secretariat—overseeing Six Ministries. In 1380, the Hongwu Emperor executed Chancellor Hu Weiyong and abolished the highest level of administration, the Central Secretariat, while dividing the Chief Military Commission and reorganizing the Censorate. He personally took control of the Six Ministries and five Chief Military Commissions, placing their leaders at the top of the official hierarchy. These six ministers and the head of the reorganized Censorate were informally known as the "Seven Chief Ministers" (). In more important court discussions, they were joined by the head of the Office of Transmission () and the head of the Court of Judicature and Revision, making them the "Nine Chief Ministers". While matters involving multiple departments were discussed by the Seven or Nine Chief Ministers, the final decision always rested with the emperor, who had the power to change it at any time.

The administration of the empire required a well-structured system of laws. In 1364, the Hongwu Emperor ordered the compilation of a new Confucian legal code, known as the Great Ming Code. This code was heavily influenced by the Tang Code from 653. The initial draft was completed in 1367 and the final version was adopted in 1397. This code remained unchanged until the empire's downfall, when it was amended with additional provisions.

The judiciary in China was not independent; local civil authorities held judicial power. Verdicts made by local authorities were subject to review by provincial authorities, and important cases were reviewed by the Ministry of Justice. Conflicts involving military personnel and the law were handled by their commanders, with further review taking place at the provincial regional military commissions and the Chief Military Commissions in the capital. Cases overseen by provincial control authorities were examined by the Censorate. The most serious cases were discussed by the Court of Judicature and Revision, which included representatives from the Ministry of Justice, the Chief Military Commissions, and the Censorate. The emperor's approval was required for death sentences.

Offices of the Imperial Household

The staff of the imperial household was composed of eunuchs and women, each with their own designated offices. The female staff were responsible for various tasks, including service, ceremony, clothing, food supply, bedchamber, crafts, and staff supervision. By the 1420s, eunuchs had taken over most of these roles, leaving only the office of clothing for women.

The Hongwu Emperor initially placed the relatively small number of eunuchs under the Directorate of Palace Attendants (). However, as their numbers grew, so did their power and influence, resulting in the creation of twenty-four major agencies ()—twelve directorates (; jian), four offices (; si), and eight bureaus (; ju)—to manage the thousands of eunuchs. The eunuch directorates were responsible for tasks such as staff control, ceremonies, food supply, kitchen utensils, documents, stables, seals, and clothing. Offices were established for fuel, music, paper, and baths, while bureaus were in charge of weapons, silverware, laundry, headgear, bronze products, textile production, vineyards, and orchards.

The Hongwu Emperor prohibited eunuchs from learning to read and involving themselves in political affairs. It is uncertain how strictly these laws were enforced during his own rule. However, when the Yongle Emperor ascended to the throne, eunuchs were able to hold positions of power, oversee state workshops, lead armies, and interfere in the selection and appointment of officials. This eventually led to the establishment of a separate administrative network, controlled by eunuchs and operating independently from the standard bureaucratic system. While a few eunuchs such as Wang Zhen, Wang Zhi, and Liu Jin held quasi-dictatorial power during the Ming dynasty, the extent of eunuch influence was not openly apparent until the 1590s, when the Wanli Emperor expanded their authority over the civil administration and granted them the right to collect provincial taxes.

One of the most effective means of controlling subjects was through the secret service, initially based in the Eastern Depot and later in the Western Depot. This secret service was directly subordinated to the Directorate of Ceremonial, which represented a significant power center during the Ming period. Over time, the eunuch in charge of the Directorate of Ceremonial gained the position of chief of the palace staff and almost dictatorial power in the empire.

While the majority of the palace staff consisted of eunuchs and women, there was also a group of officials in the Seal Office () who worked alongside the eunuchs to maintain and preserve seals and seal implements. Other palace officials were responsible for overseeing the affairs of the imperial princes. The emperor chose and supported the palace staff, both eunuchs and officials, who were collectively known as the "inner court". This was in contrast to the "outer court", which consisted of the Six Ministries, the Censorate, and other authorities.

Civil authorities Grand Secretariat and Six Ministries Despite the official rhetoric of resisting Mongol rule and reviving the Tang dynasty model, the Hongwu Emperor did not simply restore the old system or copy the Yuan dynasty's administrative structure. Instead, he incorporated elements of traditional Chinese administration, dividing it into civil, surveillance, and military offices. At the center of this system was the Central Secretariat (; Zhongshu Sheng), led by two grand chancellors (; chengxiang) of the rank 1a, known as "of the left" (senior) and "of the right" (junior). These two were informally referred to as the "Prime Ministers" (; zaixiang). The Secretariat oversaw Six Ministries and other civil authorities.

Submissions and memoranda addressed to the emperor were centralized in the Office of Reports Inspection (; Chayan si) starting in 1370, which was later renamed the Office of Transmission (; Tongzheng si) in 1377. Copies were sent to Offices of Scrutiny (; ke), which oversaw the various ministries, while the original was sent directly to the emperor. With the emergence of the grand secretaries, a new process was implemented where they would propose a solution to the emperor, and after receiving his signature, the relevant supervisory authority would forward the documents to the appropriate ministry. In most cases, the matter was first discussed by the seven or nine chief ministers, and the Office of Transmission then reviewed the ministers' written opinions. The final decision was then announced through an imperial decree in the court record (; chaobao) and in a condensed form in the Beijing Gazette (; dibao), which also included reports on the country's domestic and foreign policies.

In 1380, the Hongwu Emperor abolished the Central Secretariat and personally took over the management of Six Ministries. This resulted in the concentration of the country's administration directly in the hands of the emperor. The Emperor soon became overwhelmed by a large amount of official correspondence and reports. As a solution, in 1382 he appointed several (usually three to six) grand secretaries (; daxueshi) from the members of the Hanlin Academy. These grand secretaries served as the emperor's advisors and also assisted the tutors of the heir apparent.

Originally, the grand secretaries recorded imperial decisions. Later, the Yongle Emperor transferred the handling of his correspondence to the grand secretaries, and from the 1420s they gained a dominant role in the government. However, they never held the same status as the former Central Secretariat—they did not have the authority to give orders to other authorities or require reports. Although their rank remained at the low level of the rank 5a, their actual power was demonstrated through the granting of formal titles such as minister or vice minister, and later the ancient high titles of "Three Ducal Ministers" (; sangong) associated with the rank 1a, and "Three Solitaries" (; sangu) with the rank 1b. The term Grand Secretariat (; Neige), which was informally used at the time, was not officially introduced until the mid-16th century. Members of the Grand Secretariat were chosen from the Hanlin Academy, with the understanding that they would serve as instruments of the emperor's will without any influence from the ministry. Unlike the leaders of the ministries, they did not have to go through long-term service in regional and central offices, which led to them being viewed as outsiders by the officials of the government apparatus and being counted among the "inner court". In reality, the Grand Secretariat followed its own agenda, often diverging from both the emperor and the ministerial administration.

The Grand Secretariat played a coordinating role, while the Six Ministries (; bu)—Personnel, Revenue, Rites, War, Justice, and Works—were responsible for their own administrative tasks. Each ministry was led by a minister (; shangshu) with the rank 3a, which was upgraded to the rank 2a in 1380, and a vice minister (; shilang).