Jannik Sinner secured his place in the quarter-finals at Indian Wells after defeating Joao Fonseca in a tightly contested match.