Brazil's government has confirmed it spied on a number of targets, including representatives from Russia, Iran and the US.