たまたま means 'by chance' or 'coincidentally', without the positive nuance of a lucky outcome that うまい具合に carries.
Written forms
うまい具合に
Standard kanji-kana mix; the most common written form.
上手い具合に
Alternate kanji for うまい; less common but still encountered.
Etymology
Phrase combining うまい (good, skillful) and 具合 (condition, state) with the adverbial particle に. The exact historical derivation is uncertain, but it functions as a set adverbial phrase meaning 'in a good way' or 'luckily'.