In this paper we integrate at the tactical level two decision problems arising in container terminals: the berth allocation problem, which consists of assigning and scheduling incoming ships to berthing positions, and the quay crane assignment problem, which assigns to incoming ships a certain quay crane profile (i.e. number of quay cranes per working shift). We present two formulations: a mixed integer quadratic program and a linearization which reduces to a mixed integer linear program. The objective function aims, on the one hand, to maximize the total value of chosen quay crane profiles and, oil the other hand, to minimize the housekeeping costs generated by transshipment flows between ships. To Solve the problem we developed a heuristic algorithm which combines tabu search methods and mathematical programming techniques. Computational results on instances based on real data are presented and compared to those obtained through a commercial solver. (C) 2009 Elsevier Ltd. All rights reserved.