Oil gains on rosier outlook for global economy, fuel demand