It is a complex question. The act which set in motion a chain of events that led to the war was the assassination of Archduke Franz Ferdinand, in Sarajevo, on June 28, 1914. He was the heir presumptive to the Austrian throne. Austria believed that Serbia was responsible. It delivered an ultimatum to Serbia and declared war when Serbia did not comply. Serbia appealed to its ally, Russia, which began to mobilize. Austria then appealed to its ally, Germany, which began to mobilize. Whenever the Germans began to mobilize, the French go nuts, so they began to mobilize too. At this point, Germany starts to attack France and Russia, and, as part of that, starts marching through Belgium, in violation of a 1839 treaty to which England was a party. So England declared war on Germany, and the whole continent was at war, and the First World War had begun.
Many historians believe that if Germany had not backed Austria in its dispute with Serbia, the conflict could have been localized in the Balkans.