The first (plural) sentence is the correct one. That is the answer you should choose, say, on an English exam.
However, the second is also permissible because a plural can be re-imagined as a singular. This becomes even more evident if you explicitly provide a singular character for the plural. For example, you could say
"The last ten years was the best time of my life."
Notice how the word "time" shows that you are thinking of the plural years as a singular entity, a "best time". "Were" would be better, but I would consider this sentence correct and natural even though it violates a grammatical rule by saying "ten years was" instead of "ten years were". If you replaced "time" with a plural, you could not get away with this:
"The last ten years WERE the best ONES of my life."