China and the European Union reached a narrow agreement on rare earth exports during a summit in Beijing.