Long before the Elves awoke, Yavanna created the Two Trees of Valinor to give Light to realm of the Valar. So began a reign of peace in Valinor, but Middle-earth was lit by starlight alone, and Melkor worked in the depths of Utumno in the North of the world. We are not told how long this time lasted, just that 'the ages drew on'; this period would have lasted roughly 10,500 years. It was during this period that Aulë made the Dwarves, and set them to sleep until the coming of the Elves.
When Oromë discovered that the Elves had awoken at Cuiviénen, great changes came about. The Valar made war on Melkor to protect the Elder Children of Ilúvatar; Utumno was destroyed and Melkor brought in chains to Valinor. The Valar also summoned the Elves to dwell in their land, and many answered this summons.
These Years came to an end when Manwë released Melkor from his imprisonment. For a time, the Dark Lord pretended friendship with the Eldar, but he turned back to the darkness. With Ungoliant, he destroyed the Trees, stole the Silmarils and fled back to the north of Middle-earth. Seeking revenge, Fëanor led a great part of the Noldor out of Valinor and back to Beleriand.
So the Years of the Trees came to an end. At this time, the Valar made the Sun and Moon to give light to the world, and the Years of the Sun began, and with them the centuries that would bring the First Age to its end.
Notes
1
Tolkien provides precisely dated annals for the Years of the Trees in the Annals of Aman (in Morgoth's Ring, volume X of The History of Middle-earth). According to this source, the Trees shone for a total of 1,495 'Valian Years'. Valian years are rather longer than solar years - one Valian Year is equivalent to about 9.582 Years of the Sun, so the Years of the Trees lasted in the region of 14,325 years, in our terms. All estimates of duration in this entry are based on figures from the Annals of Aman.