Between 1916 and 1924, future World Champion J.R. Capablanca, as of 1921, experienced a period of eight years without a single tournament defeat. He was then regarded as one of the world's best defensive players, although he also drew more than other grandmasters of similar stature. Has any grandmaster or world champion since then had an equal or longer record of being undefeated?
From this Chess.com Discussion
In terms of games played, it would be Tal with 95 games (46 wins, 49 draws) from October 23, 1973 to October 16, 1974. He also has the second longest streak of 84 games (47 wins, 39 draws) from July 1972 to April 1973. In terms of time, Capablanca was undefeated for 63 games (40 wins, 23 draws from February 10, 1916 to March 21, 1924.
To answer this question you would first have to explain what you mean by "long".
If you define "long" as over the number of games played, then the next question is "which games do you count?" It shouldn't be surprising that if a grandmaster plays in their local weekend circuit against much-weaker players, they are almost never going to lose. For the record to have value then, one needs to impose restrictions on the strengths of the opposition. If you argue that you count all FIDE-rated games, then Bogdan Lalic reached 155 games undefeated. Alternatively if you require master-level opposition, then the record holder is current world champion Magnus Carlsen, who was undefeated over 125 games (or 122 games if you follow Carlsen and do not count three games against opponents rated over 500 points lower).
Alternatively, if you define "long" as "years without a loss", then Carlsen is not anywhere close to the record since his streak lasted for only two years. In this case you could argue for Steinitz, who was undefeated for 9 years winning 25 consecutive games in the process. However, that streak was only 32 games. Or you could argue for Bobby Fischer, who was undefeated from 1975 to 1992, during which he played 0 games. But at that point, why stop with Fischer? You could probably pick a random person off the street and they would've been undefeated for years.
In short, you need to define carefully what the scope of the record you're considering is. As far as I'm aware, the longest unbeaten streak is usually attributed to Carlsen, but there will be people who consider otherwise.
Sergey Tiviakov in the latest number of New in Chess (2017/3):
It is a well-known fact that I am the official world record holder, as I played 110 tournament games without a defeat in the period 2004-2005. That streak lasted for 11 months. In that period I played a lot against world top players like Aronian, Radjabov, Ivanchuk and Carlsen (just to name a few).
Chessbase has now published Tiviakov's 110 games in a row without a loss: Ding defeated! Tiviakov celebrates!