We simulate three-dimensional, turbulent flow past an axial-flow marine hydrokinetic (MHK) turbine mounted on the bed of a rectangular open channel by adapting a computational framework developed for carrying out high-resolution large-eddy simulation (LES) in arbitrarily complex domains involving moving or stationary boundaries. The complex turbine geometry, including the rotor and all stationary components, is handled by employing the curvilinear immersed boundary (CURVIB) method [1,2]. Velocity boundary conditions near all solid surfaces are reconstructed using a wall model based on solving the simplified boundary layer equations [2]. To demonstrate the capabilities of the model we apply it to simulate the flow past a Gen4 axial flow MHK turbine developed by Verdant Power for the Roosevelt Island Tidal Energy (RITE) project in the East River in New York City, USA. We carry out systematic grid refinement studies, using grids with up to 185 million nodes, for only the turbine rotor placed in an infinite free stream to show that the computed torque converges to a grid insensitive value, which is in good agreement with field measurements. We also carry out LES for the complete turbine configuration, including the pylon, nacelle and rotor, mounted on the bed of a straight rectangular open channel. The computed results illustrate the complexity of the flow and show that the power output of the complete turbine is primarily dependent on the rotor geometry and tip speed ratio, and is not affected by the stationary components of the turbine and the presence of the channel bed. The complete turbine simulation also reveals that the downstream wake of the turbine consists of three main regions: (1) the outer layer with the spiral blade tip vortices rotating in the same direction as the blades; (2) the counter-rotating inner layer surrounded by the spiral tip vortices; and (3) the core layer co-rotating with respect to the tip vortices. This study is the first to report the three-dimensional wake structure of MHK turbines.