A magic act is a form of entertainment where a performer uses a variety of props and actions to give an audience an impression that something amazing or impossible has occurred, with the implication that superstitious magic powers were involved.
Most often, rational analysis can explain the trickery or technology used to create this impression, but some of the entertainment value stems from the fact that the audience knows that most types of magic implied are not possible by the standard laws of the universe, and is amazed at being fooled in such a way. Similarly, a magic act that is not convincingly performed can be entertaining on the basis of comedy.
In 2264, Amelinda Lukarian performed her magic act for the USS Enterprise crew. She was angered when Spock attempted to deduce how she performed her tricks, prompting her to make him part of her act. She later performed for the crew of a Klingon warship. (TOS novel: Enterprise: The First Adventure)
In 2269, some of the senior staff of the Enterprise attended a magic show on Starbase 13 where a magician (who billed himself as Dr. Faustus) performed the common illusion of sawing a woman in half. In particular, Spock was prepared to analyze the possible use of mirrors and sleight-of-hand to explain much of the performance rationally in discussion with his colleagues.
The show took a strange turn when the illusionist, through unspecified means, created a series of horrific illusions of demons to appear the share the dark room with the audience, nearly sickening even the brave Enterprise crewmembers. Audience member Gilla Dupree panicked and shouted at the demons before passing out. (TOS novel: Devil World)
In 2287, on the USS Enterprise, Hikaru Sulu performed a magic act for the Enterprise-A crew. His final trick was to perform the illusion of sawing Pavel Chekov in half, before the senior staff was called to assemble for a priority mission briefing. After everyone left Chekov alone, Sulu was kind enough to return and reassemble his friend and release him from the box. (TOS comic: "So Near the Touch")