Detached geographical position of Japan and its unique natural environment greatly influenced the emergence and history of Shinto religion.
The most ancient origins of Shinto are connected with animistic Koshinto beliefs in prehistoric Japan which are traced back even to 12,000 BC. The ancient Japan culture was unusually complex. There are no written sources from this era, but elaborate pottery and jewelry were common in Japan several thousand years ago. This was the time of cultural and economic prosperity as well as the creation of the distinctive Japanese spirituality.
In the beginning of the first millennium the evolution of ethnical Japanese religious traditions was dramatically influenced by the expansion of Buddhism from the continent. The Buddhist philosophy and rituals significantly reshaped and enriched the traditional ancient Koshinto religion.
Now the word Shinto generally refers to the tradition which emerged in Japan in 6th century with the great impact of Buddhism from China and some influence of Taoism. The oldest recorded usage of the word Shindo is from the second half of the 6th century. The original meaning of the word Shindo was "way of the gods", where the "way" has a meaning of spiritual and philosophical path similar to the Chinese word Dao. Thus, Buddhistic and Taoist philosophical and meditative religious approach was combined with much more action-centered ethnic Japanese Koshinto. This unique mixture of religions eventually evolved into distinctive and highly complex traditions.
The earliest records of Japanese religious practices were written by Chinese traders. The Chinese trade goods, especially mirrors, swords, and jewels, were highly important for the early medieval Japanese society. With the establishment of imperial household in Japan these objects became the symbols of imperial divinity and the Shinto honorary objects.
Another major factor which led to the evolution of Shinto was the development of rice culture in Japan. With the improvement of agriculture Japanese people became more connected with the land and this also resulted in the creation of more complex religion to reflect their new way of life. The development of the famous Shinto harvest festival niiname is attributed to this period in early Middle Ages.
The first written source of Shinto is The Kojiki (Record of Ancient Matters) which was based on the ancient Japanese myths and legends augmented by some Buddhist, Confucian, and Taoist themes such as the The Theory of Five Elements. Supposedly, this text was written in the beginning of 8th century in order to substantiate the legitimacy of the Imperial house, based on its lineage from the sun goddess Amaterasu.
Since this time the history of Shinto is closely connected with the domestic policy of the Imperial house and various feudal authorities in Japan. Although the Kojiki included many foreign elements, it was the main source for establishing the state religion based mostly on national Japanese traditions and rituals.
During the Middle Ages Buddhism and traditional Shinto coexisted in Japan in various forms often determined by political circumstances. The only apparent difference between Japanese beliefs and the Buddhist philosophy was in the explanation of the nature of kami, the supernatural beings which played an important role in Japanese religions. There was no formal Shinto theology in medieval Japan and the amalgamation of different beliefs was dominant for many centuries.
Some attempts to separate "pure" Shinto from Buddhism were made in 18th century. However, there were so many explicitly Buddhist and Taoist concepts in medieval Shinto tradition that it was almost impossible to distinguish specific Japanese tradition. For example, the co-creator deities Izanami and Izanagi in Shinto are almost identical to yin and yang in Taoism.
Buddhism and Shinto were formally separated by the state authorities during the Meiji restoration in the second half of 19th century. This separation policy, called shinbutsu bunri, included the separation of kami (native Shinto deities) from buddhas, and of Buddhist temples from Shinto shrines. Japanese government opposed Buddhism as a foreign import and strived to unify the nation using nationalistic "pure" Shinto. However, this policy was not fully successful. Even today the separation is still only partially complete: many major Buddhist temples retain small Shinto shrines.
The so-called State Shinto introduced by Meiji government eventually became the key element of Japanese nationalism during the first half of 20th century. Official Shinto theology was based on the divinity of Japan's national origins and its Emperor.
In the post-war Japan people's overall religiosity slightly decreased, but numerous "new religions" and sects emerged on the basis of folklore Shinto beliefs and some relatively modern spiritual practices. Shinto has also spread outside Japan. For example, there are several Shinto shrines and priests in the US.
In modern Japan Shinto is more focused on old folk traditions rather than on patriotic aspect of religion. Shinto and its values remain the key element of the Japanese cultural mindset.