You pay all costs and follow all timing rules for cards played this way. For example, if the exiled card is a land card, you may play it only during your main phase while the stack is empty and only if you have an available land play remaining.

Artwork
Loading artwork…
Kirk, Enterprising Captain
Star Trek Commander · #198 · EN
Nonfoil—Foil—
Card rules
Menace (This creature can't be blocked except by two or more creatures.)
Whenever Kirk attacks while creatures you control have total power 8 or greater, exile the top card of your library. You may play that card this turn.
4/3
"Risk is our business."
Mythic · Illustrated by Nathaniel Himawan
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Gladiator Legal
Historic Legal
Legacy Legal
Oathbreaker Legal
Timeless Legal
Vintage Legal
Alchemy Not Legal
Future Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Tlr Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
If creatures you controlled had total power 8 or greater at the time you finished declaring attackers, it doesn't matter what the total power of creatures you control is when Kirk's ability resolves. You'll still exile the top card of your library and have permission to play it this turn.