Japanese referee Yuichi Nishimura used the spray when Croatia gave away a first-half free-kick in Sao Paulo.
For free-kicks near the penalty area, the referee sprays a circle round the ball and paces out 10 yards from where it has been placed.
The line marks the position where the defensive wall should stand.
The spray disappears from the grass within a minute.
The system has been used in Brazilian and Argentine football for several seasons, and was also trialled at last year's Fifa Under-20 World Cup.
It will also be introduced to the Champions League next season.