A region of war-ravaged Somalia elected a new president on Tuesday, a peaceful transfer of power in a part of the country notorious for piracy and Islamist militias.