The Zizhi tongjian 资治通鉴 "Comprehensive mirror to aid in government" is one of the most important traditional histories of China. In respect of influence it is only second to the first universal history of China, the Shiji 史记, or even surpasses the latter. The Zizhi tongjian was written by the Northern Song period 北宋 (960-1126) writer and politician Sima Guang 司马光. The Zizhi tongjian consists of 294 juan "scrolls" plus 30 juan of register (mulu 目录) and a text-critical apparatus (kaoyi 考异) of 30 juan. It covers the time period between the reign of King Weilie 周威烈王 (r. 425-402 BCE) of the Eastern Zhou dynasty 东周 (770-221 BCE) and the reign of Emperor Shizong 后周世宗 (r. 954-959) of the Later Zhou 后周 (951-960), or the years 403 BCE to 959 CE.

Sima Guang had always been interested in history but was repelled by the bad structure of traditional historiography which made an access to events and their circumstances very cubersome, especially in the official dynastic histories that are written in a biographic-thematic style (jizhuanti 纪传体). He therefore decided to write history by himself. His first work was a draft called Tongzhi 通志 "Comprehensive records" in 8 juan, covering the Warring States period 战国 (5th cent.-221 BCE)and the short-lived Qin dynasty 秦 (221-206 BC). He submitted this book to Emperor Yingzong 宋英宗 (r. 1063-1067) in 1066 who immediately appreciated it and ordered to continue the work. Emperor Shenzong 宋神宗 (r. 1067-1085) granted the book the title of Zizhi tongjian, wrote a preface to it and had it included in the Institute for the Veneration of Literature 崇文院 of the Imperial Archives. In 1084 the whole book was completed.
Although Sima Guang is often called the sole author of the book he had only written part of it. The rest was compiled by a team of historians under his supervision. The most important members of the team were Liu Shu 刘恕, Liu Ban 刘攽 and Fan Zuyu 范祖禹. Liu Shu was a historian of wide knowledge who constructed the theoretical background of the Zizhi tongjian. Liu Ban was an expert on the history of the Han period, Fan Zuyu on that of the Tang period 唐 (618-907).

The composition of the Zizhi tongjian was made in three steps. In the first step the compilers collected all available source material from all ages, put together accounts on specific events and arranged the material chronologically. The result was the so-called congmu 丛目 "clustered overview". The second step was to screen the material, to eredicate redundancies, to select the most detailed passages, and to clear contradictions. The result was the changbian 长编 "long version". This version was again, in a third step done by Sima Guang himself, abbreviated and refined.

The compilers of the Zizhi tongjian used a vast amount of material, not only the official dynastic histories and miscellaneous histories, but, especially for the Tang period, a lot of official and private sources of all kinds: veritable records (shilu 实录), family registers (jiapu 家谱, pudie 谱牒), family biographies, condolences and essays. The text-critical apparatus is of great help to reconstruct wordings in primary sources.

The great advantage of the Zizhi tongjian over the official dynastic histories is that it is arranged chronologically. While the latter are following a biographic-thematic pattern of historiography (jizhuanti 纪传体) in which specific historical events are to be found in many different chapters, namely the biographies of the persons involved, the Zizhi tongjian follows a chronological pattern (biannianti 编年体), coupled with a short introduction and summary to each important event. This makes is very easy for the reader to follow the course of events and to understand how things in history developed. Inspite of this great advantage the Zizhi tongjian is still a traditional history which lays most stress on political events, not on the history of culture, economy, literature, and so on. It is also influenced by Confucian thinking of righteous rule and usurpatious rule and is therefore biased towards persons thought to be not backed by a right to rule. Sima Guang gives his own comments to history, in paragraphs introduced by the words chen Guang yue 臣光曰 "servant Guang says". His book served in first line as a textbook on governance and should be read by princes and emperors as a guideline how to rule and what not to do as a ruler. Sima Guang was an excellent author whose literary talent is seen in the Zizhi tongjian. It is one of the most-read traditional histories of China.

A textual revision was undertaken after the submission to the throne, and in 1086 the Zizhi tongjian was printed in Hangzhou 杭州, Zhejiang. The print is lost, and from a print from 1132 only fragments exist. During the Qing period 清 (1644-1911) Hu Kejia 胡克家 reprinted a Yuan period 元 (1279-1368) version, which served also as the base for the modern reprint by the Zhonghua shuju press 中华书局 in 1956.