Shakira has reached a last-minute settlement with Spanish prosecutors over allegations of tax evasion, on the opening day of her trial in Barcelona.