adverb
by chance; coincidentally; unexpectedly
Describes something happening accidentally or without planning, often with a nuance of fortunate or surprising timing.
たまさか駅で旧友に会った。
I ran into an old friend by chance at the station.
たまさか見つけた古本屋で絶版本を手に入れた。
I got an out-of-print book at a secondhand bookstore I happened to find.
adverb
rarely; seldom; once in a while
Indicates low frequency; something that does not happen often. Often used with a negative or limiting expression.
彼はたまさかしか故郷に帰らない。
He rarely goes back to his hometown.
たまさかの休みには温泉に行く。
On the rare days off, I go to a hot spring.
偶然 is a more formal and explicit word for 'coincidence' or 'by chance', used as a noun, na-adjective, or adverb. たまさか is an adverb only and carries a softer, more subjective feel.
Derived from たま (occasional) + さか (an old suffix indicating manner or degree). The exact historical development is uncertain, but it has been used since classical Japanese to express rarity or chance.